Base solution for your next web application
Open Closed

MAUI Project Build - Program does not contain a static 'Main' method suitable for an entry point #11467


User avatar
1
BiopanelSys created

Program does not contain a static 'Main' method suitable for an entry point

This happens with new downloaded project - anyone able to know how to resolve?

ASP.NET CORE & Angular (single solution) .NET7 v12.0.1

Many Thanks


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you check this document https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation?view=net-maui-7.0&tabs=vswin to see if you have anything missing for running the MAUI app ? This can be caused by a missing workload installation or old version of Visual Studio.

    Thanks,

  • User Avatar
    0
    johnmalone created

    Any resolution to this? I am running Visual Studio 2022 17.5.1 with all workloads according the the article and I am still getting these 2 errors.

    I also have tested the .NET Maui "Hello World" app and it works fine.

  • User Avatar
    0
    johnmalone created

    How does this support forum work? My company paid for ASP.NET Zero and we are supposed to get a year of support. I am still wrestling with this issue. Can someone please provide assistance?

  • User Avatar
    1
    edarib created

    The MAUI project only includes iOS and Android platforms.

    You get the error "Program does not contain a static 'Main' method suitable for an entry point" if you are trying to run it under Windows.

    It will work on Windows, if you target Android.

  • User Avatar
    0
    alexanderpilhar created

    Thank you very much @edarib!

    For anyone who wonders what to do:

    • Right-click project YourProjectName.Mobile.MAUI.
    • Click on Properties.
    • There under Application -> Android Targets click the checkbox Target the Android platform.

    You may need to clean your solution and rebuild it. If cleaning fails just restart Visual Studio and try again.

    I hope this helps!