Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Register Windows.Devices.Bluetooth

I have been trying to register the Windows.Devices.Bluetooth, so that I can work with the code found at http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.rfcomm.aspx

Even though I have the SDKs installed from VS 2013 Pro Update 3, and the Windows 8 SDKs, the only place I have found these assemblies is in the C:\Windows\System32 folder.

When I try to register them into my project I am getting "A Reference to 'C:\Windows\System32\Windows.Devices.Bluetooth.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

I have tried this when running VS as admin and without.

Anyone else have this issue, and how did you get over this obstacle?

like image 629
Brian Webb Avatar asked Jul 10 '14 07:07

Brian Webb


People also ask

Why is my PC not finding Bluetooth devices?

Check your PCTurn Bluetooth on and off: Select Start , then select Settings > Devices > Bluetooth & other devices . Turn off Bluetooth, wait a few seconds, then turn it back on. Remove the Bluetooth device, then add it again: Select Start , then select Settings > Devices > Bluetooth & other devices ..

Why is my Bluetooth device not showing up Windows 10?

Right-click the Bluetooth icon present on the notification center of the taskbar. Select Open Settings. Select More Bluetooth options. Check Allow Bluetooth devices to find this PC (to protect your privacy, select this check box only when you want a Bluetooth device to find your computer).

How do I manually add a Bluetooth device in Windows 10?

On your PC, select Start > Settings > Devices > Bluetooth & other devices > Add Bluetooth or other device > Bluetooth. Choose the device and follow additional instructions if they appear, then select Done.


1 Answers

The solution is a combination of everything.

  1. Add <TargetPlatformVersion>8.0</TargetPlatformVersion> to the csproj
  2. Add 'Windows.winmd' to your references.
  3. Add C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\System.Runtime.dll to the references.

The default System.Runtime that is part of core does not contain the System.Attribute that the Windows.winmd needs to do anything.

This means that I can now build desktop console applications to work with bluetooth as long as my deployment target is Windows 8.0 and higher.

like image 77
Brian Webb Avatar answered Oct 17 '22 03:10

Brian Webb