开发常用脚本 -- 自动打包并发布nuget包脚本

首先从NuGet官方网站下载NuGet.exe程序,并添加到环境变量里面(大家应该都会),或下载后保存到当前文件夹下。

创建编写 nugetCreatPack.sh 脚本文件,内容如下:

if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
nuget spec AppLogger.csproj -Force
nuget pack

pause

创建编写 nugetPush.sh 脚本文件,内容如下:

@echo off
::nuget push xxx.nupkg nuget_apikey -Source https://api.nuget.org/v3/index.json
if not "%1"=="" (
nuget push %1 oy2o4uu2ztnyagk4bkgqknuhd***************y672pm -Source https://api.nuget.org/v3/index.json
) else (
echo.
echo 错误:参数为空
echo 用法:%0 待发布的nuget包名
echo 例如:%0 test.AppLogger.1.0.7.nupkg
)

pause

 

posted on 2021-06-22 14:06  jack_Meng  阅读(173)  评论(0编辑  收藏  举报

导航