I am programing a BluetoothLE device. Same code works fine for console app.
But when I put that code into .NET framework, I get a runtime exception
System.PlatformNotSupportedException: 'Windows Runtime (WinRT) is not supported on this platform.'
Both VS2019 and VS2022 have the same problem. However the same program works fine in VS2015.
This is the example I followed: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattcharacteristic?view=winrt-22621
I tried to add <TargetPlatformVersion>10.0</TargetPlatformVersion> in to the .csproj. But it does not help.