Reputation: 5
I am trying to run a MAUI app that was running on a another computer which I cannot access now, but it is not running on my current laptop.
The error I get is before initializing.
System.Runtime.InteropServices.COMException
HResult=0x80040154
Message=Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at WinRT.ActivationFactory.Get(String typeName)
at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions.get__objRef_global__Microsoft_Windows_ApplicationModel_WindowsAppRuntime_DeploymentInitializeOptions()
at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions..ctor()
at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS.AutoInitialize.get_Options() in C:\Users\Eneko\.nuget\packages\microsoft.windowsappsdk\1.6.240923002\include\DeploymentManagerAutoInitializer.cs:line 44
at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS.AutoInitialize.AccessWindowsAppSDK() in C:\Users\Eneko\.nuget\packages\microsoft.windowsappsdk\1.6.240923002\include\DeploymentManagerAutoInitializer.cs:line 30
at .cctor()
I tried installing the Windows App SDK x64 version.
Also tried reinstalling the C++ redistributable.
Does anyone know how to solve it?
Upvotes: 0
Views: 223
Reputation: 11
I ran into a similar issue and managed to fix it by setting the WindowsPackageType
in my .csproj
file:
<PropertyGroup>
<!-- ... -->
<WindowsPackageType>None</WindowsPackageType>
</PropertyGroup>
The WindowsPackageType
setting controls how your app is packaged for deployment. When set to None
, the app is built as a regular Win32 app (e.g., .exe
) without any additional packaging. This is usually enough for debugging in Visual Studio.
It seems that some default settings changed between .NET 8 and .NET 9, which might be the cause of the issue.
P.S. In one of my projects I had additionally modify the commandName
parameter in theProperties/launchSettings.json
file from MsixPackage
to Project
{
"profiles": {
"Windows Machine": {
"commandName": "Project",
"nativeDebugging": false
}
}
}
Upvotes: 0