App will run through visual studio but not via exe

Phunction 231 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))

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,195 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,648 questions
{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