'C# Bluetooth : My deviceInformation is different when I add app.manifest to my project
I created a desktop application using Bluetooth (BLE) and WPF but I have a problem when using app.manifest. For the same device I have different values (DeviceInformation) when I use or not app.manifest. I need to have the app.manifest and I would like to have the same result as without.
My app.manifest :
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<maxversiontested Id="10.0.18358.0"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="bluetooth" />
</Capabilities>
</compatibility>
</assembly>
My csproj :
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net471</TargetFramework>
<OutputType>WinExe</OutputType>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<Description></Description>
<Title>Test</Title>
<Configuration></Configuration>
<Copyright>Copyright © 2014-2021</Copyright>
<UICulture>fr-FR</UICulture>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Guid>02639d71-0935-35e8-9d1b-9dd1a2a34627</Guid>
</PropertyGroup>
</Project>
My function bluetooth :
public void Init(string deviceName)
{
// Get all Edan paired devices
DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(SERVICE_UID)).Completed = (asyncFindDeviceInfo, asyncFindDeviceStatus) =>
{
if (asyncFindDeviceStatus == AsyncStatus.Completed)
{
Device = asyncFindDeviceInfo.GetResults().Where(d => d.Name == deviceName).FirstOrDefault();
}
};
}
Result :
Without app.manifest : DeviceInformation.Name = "EDAN"
With app.manifest : DeviceInformation.Name = "Gatt Service {0000fff0-0000-1000-8000-00805f9b34fb}"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
