像这样调用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.WinMD
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
答案 0 :(得分:-1)