I am using the Windows.Devices.Bluetooth library in a WPF application using the .net 5.0 framework. I have referenced the windows api by installing the CSWinRT nuget and using the target framework moniker in my csproj file like this:
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
This is instead of adding references to windows.winmd and windowsruntime.dll as you had to do pre-.net5. I am able to use the windows library with no problem, but I am also using a class library made from a different project using .net 4.7.2 which also references/uses the Windows.Devices.Bluetooth library and thats when im getting this error:
Severity Code Description Project File Line Suppression State Error CS0012 The type 'BluetoothLEDevice' 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'. 128 Active
So i can access the library directly but not through the dll. Maybe its a problem that the dll uses a different framework?
Does anyone know how to solve this?