繁体   English   中英

Visual Studio:缺少对“Windows”的程序集引用

[英]Visual Studio: Missing assembly reference to “Windows”

我正在尝试运行在 C# 中找到的示例代码:

https://code.msdn.microsoft.com/Sending-toast-notifications-71e230a2/sourcecode?fileId=51046&pathId=1435720579

在 Microsoft Visual Studio 中打开时,它缺少对简单称为“Windows”的引用。 不是“System.Windows”,也不是“WindowsBase”,而只是“Windows”。

在 Visual Studio 中或在线搜索 NuGet 包已被证明是徒劳的,可能是因为结果与任何提及“Windows”的内容无法区分,后者是一堆可能的引用(包括,例如,“System.Windows”) )。

package 还需要我通过 NuGet 找到的几个 WindowsAPICodePack 引用,所以它们不是问题。 我缺少的只是这个神秘的“Windows”引用,它在 Visual Studio 中无法通过“添加引用...”获得,而且我无法在网上或 NuGet 中找到。

Windows.dll是 UWP 参考,这是在您的示例中调用ToastNotificationManager.GetTemplateContent方法所必需的。

您还有Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL参考,它在 Nuget 上可用,您可以安装它并更新参考路径。

<TargetPlatformVersion>8.1</TargetPlatformVersion> says that you'll need to install Windows 8.1 SDK or install Windows 10 SDK and upgrade the target platform

实际上,您尝试运行的示例已经过时并且针对 VS2012。 您可以使用来自MSDN的更新和现代的 toast 通知示例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM