【发布时间】:2019-01-17 22:28:39
【问题描述】:
像这样调用 UWP API:
var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
在编译时出现错误:
The type name 'PushNotificationChannelManager' could not be found in the namespace 'Windows.Networking.PushNotifications'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly
这只是创建一个新的 WPF 应用程序并添加对以下内容的引用:
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Facade\Windows.WinMDC:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
【问题讨论】:
-
错误的 windows.winmd 文件。他们认为版本控制不是很好,并且在构建 16299 时变得混乱。我还没有安装 17134,所以不能确定,生命太短,无法跟上,但你肯定需要参考 Windows 工具包中的那个\ 10\UnionMetadata\10.0.17134.0\Facade\
-
我在 Windows Kits\10\UnionMetadata\10.0.17134.0\Facade\ 中得到了相同的结果
-
请尝试使用 NuGet 包管理器将UWPDesktop 包安装到您的项目中。
标签: c# wpf windows uwp desktop-bridge