c# – My .Net 9.0 MAUI Blazor hybrid app reports ‘does not contain a static ‘Main’ method suitable for an entry point’ when being published


In Visual Studio 2022, I created a .Net 9.0 MAUI Blazor hybrid app, which I was able to publish, straight away.

After adding content and functionality to my project, which builds and runs on all required platforms okay, attempting to publish a windows MSIX package errored with the notification:

The specified RuntimeIdentifier 'win10-x64' is not recognized. See https://aka.ms/netsdk1083 for more information.

I edited the lines of the MSIXwin10x64.pubxml file in the publishprofile directory:

<RuntimeIdentifier>win10-x64</RuntimeIdentifier>

to ‘win-x64’ and

<TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>

to ‘net9.0’, which fixed the problem.

Now when I try to publish my project for windows I receive the error:

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

I tried adding a dummy class with a Main method and the project reported:

Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.

I thought the app started from the MauiProgram.cs class, why am I having so many difficulties, please?

Leave a Reply

Your email address will not be published. Required fields are marked *