Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish .net MAUI Application as windows executable

How can I publish a .net MAUI Application to a Single executable? Is this even possible? I Have an application which I want my friends to use on their Windows PC. Is there any way without using the command prompt?

like image 828
Leo Harmsen Avatar asked Nov 26 '25 09:11

Leo Harmsen


1 Answers

With the new release of .net MAUI 6.0.400 (Service Release 1) you can build your application to a working exe file.

In Visual Studio: Right click your solution, open in terminal. Run the following command:

msbuild /restore /t:build /p:TargetFramework=net6.0-windows10.0.19041 /p:configuration=release /p:WindowsAppSDKSelfContained=true /p:Platform=x64 /p:WindowsPackageType=None /p:RuntimeIdentifier=win10-x64

or if you want to target x86 for some legacy system:

msbuild /restore /t:build /p:TargetFramework=net6.0-windows10.0.19041 /p:configuration=release /p:WindowsAppSDKSelfContained=true /p:Platform=x86 /p:WindowsPackageType=None /p:RuntimeIdentifier=win10-x86

The build exe (x64) file can be found in \bin\x64\release\net6.0-windows10.0.19041\win10-x64


Publishing to a single file is possible but currently a little bugged, for example images need to be copied from the build folder into the publish folder to work. Images used via Blazor in the wwwroot folder work without a problem though.
Publishing command:

msbuild /restore /t:Publish /p:TargetFramework=net6.0-windows10.0.19041 /p:configuration=release /p:WindowsAppSDKSelfContained=true /p:Platform=x64 /p:PublishSingleFile=true /p:WindowsPackageType=None /p:RuntimeIdentifier=win10-x64

The build exe (x64) file can be found in \bin\x64\release\net6.0-windows10.0.19041\win10-x64\publish\

like image 67
Ingo Avatar answered Nov 28 '25 23:11

Ingo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!