CS0012您必须添加对程序集Windows 255,255,255,255 WindowsRuntime的引用

时间:2018-12-08 02:48:14

标签: desktop-bridge project-centennial

我正在尝试遵循帮助on extending my winforms app with UWP

private async void button1_Click(object sender, EventArgs e)
    {
        string str = "WinTreeWUP://";

        Uri uri = new Uri(str);

        var success = await Windows.System.Launcher.LaunchUriAsync(uri);
    }

you must add a reference

此屏幕转储显示的内容,我已经添加了文档建议的参考。

UWP应用的最低版本为Windows版本1809内部版本17763 我正在使用VS2017 V15.9.3

完整错误是

CS0012  C# The type 'IAsyncAction' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.

来源位于https://github.com/kgreed/WinTree

我正在winforms项目中使用以下参考文献

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.Runtime.InteropServices.WindowsRuntime.dll
          C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.UI.Xaml.dll

C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd

C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.UniversalApiContract\7.0.0.0\Windows.Foundation.UniversalApiContract.winmd

1 个答案:

答案 0 :(得分:0)

我添加了对C:\ Program Files(x86)\ Windows Kits \ 10 \ UnionMetadata \ 10.0.17763.0 \ Windows.winmd的引用

构建不再抱怨。