在项目.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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2021-11-04
  • 2021-07-18
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案