简体   繁体   English

Windows.ApplicationModel不存在,为什么?

[英]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.

相关问题 Devops:错误 CS0234:命名空间“Windows”中不存在类型或命名空间名称“ApplicationModel” - Devops: Error CS0234: The type or namespace name 'ApplicationModel' does not exist in the namespace 'Windows' 科尔多瓦Windows 10 UWP Windows.ApplicationModel.ExtendedExecution - Cordova Windows 10 UWP Windows.ApplicationModel.ExtendedExecution MS Surface LTE:如何枚举可用的 Windows.ApplicationModel.Calls.PhoneLine? - MS Surface LTE: How can I enumerate available Windows.ApplicationModel.Calls.PhoneLine's? Windows.services中不存在命名空间`store` - Namespace `store` does not exist in windows.services 为什么在编译正常时此代码会引发“名称空间中不存在”错误? - Why does this code raise a 'does not exist in namespace' error when it compiles fine? 命名空间“Windows”中不存在类型或命名空间名称“存储”(您是否缺少任何程序集引用?) - The Type or namespace name 'Storage' does not exist in the namespace 'Windows'(are you missing any assembly references ?) 为什么 Xamarin.Forms 设计器不显示窗口布局? - Why does the Xamarin.Forms designer not show windows layouts? 为什么Google API在我的通用Windows应用程序中不起作用? - Why does the Google API not work in my Universal Windows App? 名称空间中不存在名称 - Name does not exist in the namespace 错误UWP目标中命名空间“Windows”中不存在类型或命名空间名称“Networking”,如何在多目标项目中修复project.json - Error The type or namespace name 'Networking' does not exist in the namespace 'Windows' in UWP target, how to fix project.json in multi-target project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM