首页 > 技术文章 > VS2019 发布单文件

microestc 2019-10-09 12:06 原文

在项目.csproj文件下添加

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <PublishSingleFile>true</PublishSingleFile>
    <RuntimeIdentifier>linux-arm</RuntimeIdentifier>
</PropertyGroup>

RuntimeIdentifier 为发布的平台,必填

可以选择win-x64 win-x86 等等

选择项目右键发布,编辑配置 选择操作系统平台 发布

 

以下示例将 Windows 应用作为独立的单文件应用程序发布。

.NET Core CLi
dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true

 

以下示例将 Linux 应用作为依赖框架的单文件应用程序发布。

.NET Core CLi
dotnet publish -r linux-x64 -p:PublishSingleFile=true --self-contained false

 

https://docs.microsoft.com/zh-cn/dotnet/core/deploying/single-file

 

推荐阅读