App will run through visual studio but not via exe

Phunction 301 Reputation points
2024-03-03T22:43:14.8333333+00:00

I am developing a maui app in VS 2022, Debug and Release will run fine when launched via VS.

However, when I go to the apps bin folder, it will not launch, I click on the .exe and nothing happens.

I tried copying the bin/release and debug folders to another Win10 machine, same issue. I published a msix and tried that route and it will not run.

How do I make it run without VS?

Event viewer gives me this error:

Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'WinRT.ActivationFactory`1' threw an exception.
 ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

Developer technologies .NET .NET MAUI
Windows for business Windows Client for IT Pros User experience Other
Developer technologies C#
{count} vote

3 answers

Sort by: Most helpful
  1. Peter Ritchie 76 Reputation points
    2024-03-04T19:29:31.14+00:00

    This seems related: https://github.com/microsoft/WindowsAppSDK/issues/3228

    Is it possible that Visual Studio is running with elevated permissions? When executing the application outside of Visual Studio, try running it As Administrator.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.