.net core2 项目发布nuget包。

打包

网上关于打包发布nuget包的文章有很多。我这里记录的是.net core项目特殊的地方,它可以使用 dotnet pack 命令来打包。在工程文件夹下执行命令行(.csproj文件同目录下)

dotnet pack

image.png

发布

nuget push 包名.nupkg

提示要填入source参数

nuget.exe push 包名.nupkg -Source https://www.nuget.org

发布成功

这样就将包发布到https://www.nuget.org上了,如果要发布到内网私有的nuget管理,这个地址也要替换成私有的地址。
还要等等

其他

即使安装了.net core 开发环境,能使用dotnet 命令打包,但是还是要借助
nuget.exe 来发布。我在环境变量里配置了nuget.exe 的路径,所以可以直接在命令行中使用nuget命令。

发布前需要设置setApiKey。

nuget setApiKey 你的apikey

或者在发布的时候添加

nuget.exe push 包名.nupkg -Source 地址 -ApiKey  你的apikey

猜你喜欢

转载自blog.csdn.net/yiershan1314/article/details/79125209
今日推荐