Which DLL has the Windows.Devices.Gelocation names

2019-02-28 13:17发布

问题:

I'm using VS 2012 and I need to write code that uses the classes in the Windows.Devices.Gelocation namespace. I downloaded the sample program but it won't load in VS2012 as it requires VS 2013. And the documentation for the class does not indicate which DLL that namespace is in.

Can someone tell me which DLL contains that namespace? Is it available in .NET 4 or do I have to use .NET 4.5?

Edit

My project is a console application which runs in the background as a Windows service. The searching I've done indicates that I have to target Windows 8 by using the Reference Manager's Windows Tab. But there is no Windows tab in the Reference Manager in my project because it's not a Windows Store application. Is there a way to use this API from a desktop application???

回答1:

I've found how to reference the assembly I need.

On this page, under the section Windows Tab, in the Core Subgroup subsection, the third paragraph gives instructions on how to reference the needed windows assemblies from desktop applications. To summarize it:

  1. Unload the project to which the reference will be added.
  2. Edit the .csproj file for the project.
  3. Add the following snippet anywhere in the .csproj file:

       <PropertyGroup>
         <TargetPlatformVersion>8.0</TargetPlatformVersion>
       </PropertyGroup>

  4. Save the edited .csproj file.

  5. Reload the project.

At this point, when you open the Reference Manager dialog, you'll see a Windows tab on the left. Click that, and you'll see the Core subgroup. To the right, it'll say "Targeting Window 8.0" and under that "Windows version 255.255.255.255" will be unchecked. Check it off then click OK & you're done.