Reputation: 4178
I am using MSVS 2022 preview 3.1 on Windows 10 with .NET 6.0.100-preview.7.21379.14 and I'm able to create a MAUI application and deploy it into an Android emulator.
I'd like to run it on my Windows instead because the Android emulator is very slow and I'm more interested in the desktop anyway. Is this currently possible? I've tried to build the WinUI project, it creates an executable on the disk, but when the executable is started, nothing happens.
I tried to use Publish to Folder with the same result. I tried to use Deploy, again with the same result. There are no errors in the either process, just an executable created on the disk does nothing at all.
The app was created using dotnet new maui -n HelloMauiPreview
command.
Edit:
I've put logging into obj\Release\net6.0-windows10.0.19041\win10-x64\Platforms\Windows\App.g.i.cs
file into Main
which looks like this:
static void Main(string[] args)
{
global::WinRT.ComWrappersSupport.InitializeComWrappers();
global::Microsoft.UI.Xaml.Application.Start((p) => {
...
The first line was executed no problem, and the program gets stuck somewhere inside of the second line. There is the delegate that is NOT being called. So it gets stuck somewhere between start of Start
and calling that delegate. Nothing else gets executed, so lines AFTER the global::Microsoft.UI.Xaml.Application.Start
line are not executed.
Also when I said "stuck" it is not that the app would hang there, it somehow terminates. Using Event Viewer I have found the following event:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName) in Microsoft.WinUI.dll:token 0x6000023+0x6e
at Microsoft.UI.Xaml.Application._IApplicationStatics..ctor() in Microsoft.WinUI.dll:token 0x601388f+0x1c
at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x60006c8+0x3e
--- End of inner exception stack trace ---
at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x60006c8+0x4e
at System.Activator.CreateInstance[T]() in System.Private.CoreLib.dll:token 0x60009ed+0x0
at WinRT.WeakLazy`1.get_Value() in Microsoft.WinUI.dll:token 0x6000019+0x20
at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance() in Microsoft.WinUI.dll:token 0x6013890+0x0
at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback) in Microsoft.WinUI.dll:token 0x6009288+0x0
Edit 2: The issue seems to be similar/same to https://github.com/dotnet/maui/issues/1557
Upvotes: 1
Views: 2415
Reputation: 1487
You have to set WindowsMachine
target and proper framework.
Then run by F5 and enable Install from unknown sources
or similar in settings app of Windows, for me it popped out automatically (I'm on Win11)
Then you get the app running with debug tools:
Upvotes: 3