起因:使用nuget,但是部分同事用的mac,不能用vs的包管理器查看私有nuget库里面的包,所以,就总结了几个常用的 nuget cli 命令,方便全平台使用nuget

废话不多,直入主题

准备:可以去官网查看怎么装nuget,链接:https://docs.microsoft.com/zh-cn/nuget/reference/nuget-exe-cli-reference

1.发布nuget到私有库

nuget publish -Source [你们私有库的地址]  -ApiKey [私有库秘钥]  [待发布的nuget包位置]

示例:

nuget push -Source http://192.168.192.130:8080/ -ApiKey 8c974f2d-1234-4e76-2234-86a6ab257643 .\bin\release\TestPack.1.0.0.nupkg

PS:关于创建私有nuget库,可以参考其他人的博客:https://www.cnblogs.com/chongyao/p/9226363.html

 

2.查看本地nuget包源

nuget sources list 

如图所示

打码的是公司的包地址,忘见谅

 

3.查看特定nuget库中包含的包

nuget list -Source "TestPack"

此处的 TestPack就是上面第五个显示的私有nuget库

如下图所示

 

4.删除特定nuget库的包

nuget delete TestPack 1.0.0 -Source "TestPack" -ApiKey 8c974f2d-c0b0-4e76-a93b-86a6ab257643

如下图所示

 

5.清理本地nuget缓存

dotnet nuget  locals all --clear

 

学识有限,如有错误,请指出修改!

posted on 2019-08-28 14:16  千城静流  阅读(854)  评论(0编辑  收藏  举报