问题描述
我正在使用 VS 2012,我需要编写使用 Windows.Devices.Gelocation 命名空间中的类的代码.我下载了示例程序,但它不会在 VS2012 中加载,因为它需要 VS 2013.并且该类的文档没有说明该命名空间在哪个 DLL 中.
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.
谁能告诉我哪个 DLL 包含该命名空间?它在 .NET 4 中可用还是我必须使用 .NET 4.5?
Can someone tell me which DLL contains that namespace? Is it available in .NET 4 or do I have to use .NET 4.5?
编辑
我的项目是一个控制台应用程序,它作为 Windows 服务在后台运行.我所做的搜索表明我必须使用参考管理器的 Windows 选项卡来定位 Windows 8.但在我的项目中,Reference Manager 中没有 Windows 选项卡,因为它不是 Windows Store 应用程序.有没有办法在桌面应用程序中使用这个 API???
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???
推荐答案
我找到了如何引用我需要的程序集.
I've found how to reference the assembly I need.
在此页面上,在 Windows Tab
部分下,在 Core Subgroup
小节中,第三段提供了有关如何从桌面应用程序引用所需 Windows 程序集的说明.总结一下:
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:
- 卸载要添加引用的项目.
- 编辑项目的 .csproj 文件.
在 .csproj 文件的任意位置添加以下代码段:
- Unload the project to which the reference will be added.
- Edit the .csproj file for the project.
Add the following snippet anywhere in the .csproj file:
<物业组>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
保存编辑后的 .csproj 文件.
Save the edited .csproj file.
此时,当您打开 Reference Manager 对话框时,您会在左侧看到一个 Windows
选项卡.单击它,您将看到 Core
子组.在右侧,它会显示Targeting Window 8.0",并且在Windows 版本 255.255.255.255"下将被取消选中.勾选它然后点击 OK &你已经完成了.
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.
这篇关于哪个 DLL 具有 Windows.Devices.Gelocation 命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!