[英]Windows.ApplicationModel does not exist, why?
I met an UWP issue, and asked question as below post: How to detect user idle in UWP? 我遇到了UWP问题,并提出以下问题: 如何检测UWP中的用户空闲?
Thanks for Nico to answer my question! 感谢Nico回答我的问题! And he provided an example code here: https://stefanwick.com/2018/05/15/global-hotkey-registration-in-uwp/ https://github.com/StefanWickDev/ExtensionGallery/tree/master/GlobalHotkey
他在这里提供了示例代码: https : //stefanwick.com/2018/05/15/global-hotkey-registration-in-uwp/ https://github.com/StefanWickDev/ExtensionGallery/tree/master/GlobalHotkey
Some of the codes which report compile errors are: 报告编译错误的一些代码是:
using Windows.ApplicationModel;
using Windows.ApplicationModel.AppService;
using Windows.ApplicationModel.Core;
using Windows.Foundation.Collections;
using Windows.Storage;
But I cannot run the above code, I mean the GlobalHotkey project. 但是我无法运行上面的代码,我的意思是GlobalHotkey项目。 I got 18 compile errors as below picture shown.
我遇到了18个编译错误,如下图所示。
The first error is: 第一个错误是:
The type or namespace name 'ApplicationModel' does not exist in the namespace 'Windows'
类型或名称空间名称“ ApplicationModel”在名称空间“ Windows”中不存在
I cannot find Windows.ApplicationModel by this way: 我无法通过这种方式找到Windows.ApplicationModel:
Project -> Right Click -> Add -> Reference -> Assemblies -> Search "System.Drawing"
项目->右键单击->添加->参考->装配体->搜索“ System.Drawing”
Like this picture shown: 如下图所示:
And I did not change the code at all. 而且我根本没有更改代码。 I also install the SDK Build 17134, which is required by the original code.
我还安装了原始代码所需的SDK Build 17134。 Why?
为什么?
More: To answer Pavel Anikhouski's question, please check below picture. 更多:要回答Pavel Anikhouski的问题,请检查以下图片。 I have the two files, and no items under Universal Windows subtree.
我有两个文件,并且在Universal Windows子树下没有任何项目。
Windows.ApplicationModel does not exist, why?
Windows.ApplicationModel不存在,为什么?
The problem is you have missed Windows.winmd
reference for Desktop App. 问题是您错过了Desktop App的
Windows.winmd
参考。 You could find it with this path C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.xxxxxx.0\\Windows.winmd
for more please refer this case reply . 您可以使用以下路径找到它
C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.xxxxxx.0\\Windows.winmd
有关更多信息,请参考此案例答复 。
If your project has missed Windows Desktop Extension for UWP lib, Please install windows sdk and search it in extension list as you mentioned. 如果您的项目缺少UWP lib的Windows桌面扩展 ,请安装Windows sdk并按照您提到的在扩展列表中搜索它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.