用于桌面应用程序默认项目的 WinUI 3.0 出现运行时错误
WinUI 3.0 for desktop apps default project gives runtime error
使用Windows UI Library 3 Preview 2 (July 2020) that was released just yesterday. On latest version of VS2019 - Preview
, followed this official tutorial Get started with WinUI 3 for desktop apps 创建桌面项目。项目编译成功,但在调试模式下 运行 时出现以下错误。我正在使用 Windows10 Pro ver. 1903
:
System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void System.Runtime.InteropServices.ComWrappers.RegisterForTrackerSupport(System.Runtime.InteropServices.ComWrappers)'.
Source=WinRT.Runtime
StackTrace:
at WinRT.ComWrappersSupport.set_ComWrappers(ComWrappers value)
at WinRT.ComWrappersSupport.InitializeComWrappers(ComWrappers wrappers)
at WinUI_DesptopPreview2.Program.Main(String[] args) in C:\DotNET5VS2019\Desktop_WinUI\WinUI_DesptopPreview2\WinUI_DesptopPreview2\obj\x64\Debug\net5.0\win-x64\App.g.i.cs:line 25
错误截图:
我 运行 也遇到了这个问题,更新 .NET 5 SDK 以预览 6 为我解决了这个问题。
Link 安装程序:
https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-preview.6-windows-x64-installer
使用Windows UI Library 3 Preview 2 (July 2020) that was released just yesterday. On latest version of VS2019 - Preview
, followed this official tutorial Get started with WinUI 3 for desktop apps 创建桌面项目。项目编译成功,但在调试模式下 运行 时出现以下错误。我正在使用 Windows10 Pro ver. 1903
:
System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void System.Runtime.InteropServices.ComWrappers.RegisterForTrackerSupport(System.Runtime.InteropServices.ComWrappers)'.
Source=WinRT.Runtime
StackTrace:
at WinRT.ComWrappersSupport.set_ComWrappers(ComWrappers value)
at WinRT.ComWrappersSupport.InitializeComWrappers(ComWrappers wrappers)
at WinUI_DesptopPreview2.Program.Main(String[] args) in C:\DotNET5VS2019\Desktop_WinUI\WinUI_DesptopPreview2\WinUI_DesptopPreview2\obj\x64\Debug\net5.0\win-x64\App.g.i.cs:line 25
错误截图:
我 运行 也遇到了这个问题,更新 .NET 5 SDK 以预览 6 为我解决了这个问题。 Link 安装程序: https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-preview.6-windows-x64-installer