太方便了,开源的 .NET Core 打包工具

本文介绍了dotnet-packaging,一个开源的.NETCore工具,用于创建各种平台的安装包,如WindowsMSI、LinuxDEB和macOSPKG。文章详细讲解了安装步骤和使用教程,演示了如何为控制台应用创建.deb包。
摘要由CSDN通过智能技术生成

目录

dotnet-packaging

常用命令

如何安装

使用教程

项目地址


dotnet-packaging

推荐一个开源的 .NET Core 打包工具,100 % 使用 C# 开发,它包含了  .NET Core CLI 的命令行扩展,所以可以轻松为 .NET Core 应用程序创建部署包,比如 windows msi 文件、 Linux 安装程序 deb、 macOS 安装程序 pkg 等等,非常方便。

常用命令

  • dotnet pkg - 创建 macOS 安装程序

  • dotnet deb - 创建 Ubuntu/Debian Linux 安装程序

  • dotnet zip - 创建 .zip 文件

  • dotnet msi - 创建 Windows Installer (msi) 包

如何安装

首先,安装全局 .NET 打包工具。如果您只打算使用一个工具,则无需安装所有工具。

dotnet tool install --global dotnet-zip
dotnet tool install --global dotnet-tarball
dotnet tool install --global dotnet-rpm
dotnet tool install --global dotnet-deb

然后,在您的项目目录中,运行 dotnetztarballirpmpdebinstall 将该工具添加到您的项目中:

dotnet zip install
dotnet tarball install
dotnet rpm install
dotnet deb install

使用教程

让我们创建一个新的控制台应用程序并将其打包为 .deb 文件,以便我们可以将其安装在 Ubuntu 计算机上:

首先,创建您的控制台应用程序:

mkdir my-app
cd my-app
dotnet new console

然后,安装 dotnet-deb 实用程序:

dotnet tool install --global dotnet-deb
dotnet deb install

可以了,让我们将您的应用程序打包为 deb 包:

dotnet deb

现在有一个可以安装的 bin\Debug\netcoreapp3.1\my-app.1.0.0.deb 文件:

apt-get install bin\Debug\netcoreapp3.1\my-app.1.0.0.deb

您的应用程序已安装到 /usr/local/share/my-app 中。通过运行 /usr/local/share/my-app/my-app 来调用它:

/usr/local/share/my-app/my-app

如您所见,dotnet-packaging 使用非常简单,您可以使用它轻松的创建各个平台的安装包,只需要一行命令即可。

项目地址

https://github.com/quamotion/dotnet-packaging

 引入地址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值