davidortinau / WeatherTwentyOne

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to launch WinUI3 project on Windows 10

nodew opened this issue · comments

I can build WinUI3 successfully, but when I launch it with debug, I got the following exception:

System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=System.Private.CoreLib
  StackTrace:
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at WinRT.WeakLazy`1.get_Value()
   at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance()
   at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
   at WeatherTwentyOne.WinUI.Program.Main(String[] args) in C:\Users\wangq\development\WeatherTwentyOne\src\WeatherTwentyOne.WinUI3\obj\x64\Debug\net6.0-windows10.0.19041\Windows\WindowsApp.g.i.cs:line 26

COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

Windows 10 build version: 19042.985

Receiving same error


System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=System.Private.CoreLib
  StackTrace:
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at WinRT.WeakLazy`1.get_Value()
   at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance()
   at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
   at WeatherTwentyOne.WinUI.Program.Main(String[] args) in C:\Git\WeatherTwentyOne\src\WeatherTwentyOne.WinUI3\obj\x64\Debug\net6.0-windows10.0.19041\Windows\WindowsApp.g.i.cs:line 26

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

  • Installed "dotnet tool install -g redth.net.maui.check"
  • Ran maui-check -> "Everything looks great!"
  • dotnet --version 6.0.100-preview.4.21255.9
  • Visual Studio Community 2019 Preview 16.11.0 Preview 1.0
  • Windows Version 2004 (OS Build 19041.985)

I can run WinUI UWP and Desktop projects ref Projet Reunion sucessfully.

Solved: 'Package' project has to be launched.
image