Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Desktop C# - Referencing Windows.Devices

I am trying to create a classic desktop application for Windows 10 in C# that will be able to talk to BLE devices. I followed the instructions (Bluetooth 4.0 (low energy) API for windows desktop C# application) and added the tag to the project file

<TargetPlatformVersion>10.0.10156</TargetPlatformVersion>

and reloaded the project. I am given access to the Windows namespace only: references dialog

I don't know what I did in one of my testings, but once that list got populated with a whole lot of other namespaces, giving me the ability to check Windows.Devices namespace, which is essential for my project. I can now add the Windows.Devices via Recent option, but can not add any other namespace...

Do you guys have any idea what should I do to access the list of all Windows.x.y namespaces?

like image 354
matevzb Avatar asked May 28 '16 07:05

matevzb


People also ask

What is the desktop file path?

The location of the Desktop folder in most versions of Windows is %USERPROFILE%\Desktop , which for most users becomes C:\Users\YOURUSERNAME\Desktop .

How do I get to C desktop?

Often when opening the command prompt window, you automatically be placed in the (username) directory. Therefore, you only need to type cd desktop to get into the desktop. If you're in any other directory, you would need to type cd \docu~1\(username)\desktop to get into the desktop.

What is a computer's desktop?

A desktop is a computer display area that represents the kinds of objects one might find on top of a physical desk, including documents, phone books, telephones, reference sources, writing and drawing tools, and project folders.


1 Answers

To access Windows.Devices and other WinRT API's from .NET Framework code,

  1. Add the NuGet package Microsoft.Windows.SDK.Contracts to the project
  2. Configure the project to support Package References (right-click packages.config, select Migrate packages.config to PackageReference...)
like image 154
Carsten Hansen Avatar answered Sep 25 '22 08:09

Carsten Hansen