I'm working on UWP Application to manage a BLE / GATT device. I'm following the official documentation from Microsoft (https://learn.microsoft.com/fr-fr/windows/uwp/devices-sensors/gatt-client). But I have a problem with the async function from BluetoothLEDevice class.
When I write the following line :
BluetoothLEDevice bluetoothLeDevice = await BluetoothLEDevice.FromIdAsync(deviceInfo.Id);
I have the followings errors :
Error CS0012 The type 'IAsyncAction' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
Error CS0012 The type 'IAsyncActionWithProgress<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
Error CS0012 The type 'IAsyncOperation<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
Error CS0012 The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
I tried to add manually the following reference (Like I found in multiple post) :
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\system.runtime.windowsruntime.dll
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
But, in the first case, VS saying it is already including by the generator system (or someting like this). And in the 2nd case, I have many class in my code that are referenced twice (Like Page for example)
What is the solution ?