简体   繁体   English

将 .net MAUI 应用程序发布为 windows 可执行文件

[英]Publish .net MAUI Application as windows executable

How can I publish a .net MAUI Application to a Single executable?如何将 .net MAUI 应用程序发布到单个可执行文件? Is this even possible?这甚至可能吗? I Have an application which I want my friends to use on their Windows PC.我有一个应用程序,我希望我的朋友在他们的 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.使用 .net MAUI 6.0.400(服务版本 1)的新版本,您可以将应用程序构建为工作 exe 文件。

In Visual Studio: Right click your solution, open in terminal.在 Visual Studio 中:右键单击您的解决方案,在终端中打开。 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:或者,如果您想将 x86 用于某些旧系统:

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构建 exe (x64) 文件可以在 \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.通过 wwwroot 文件夹中的 Blazor 使用的图像可以正常工作。
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\构建 exe (x64) 文件可以在 \bin\x64\release\net6.0-windows10.0.19041\win10-x64\publish\ 中找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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