简体   繁体   中英

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?

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\

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM