Skip to main content

发布NuGet包

· 1分钟阅读

环境

❯ dotnet --version
8.0.100-preview.7.23376.3

账户

打包

  • 填一些项目的Package配置:
  • 打包
dotnet pack -c Release ./src/Kx.Toolx.Clicky

发布

手动apikey

  • 取得前面在nuget.org生成的Api Key
  • 发布:
❯ dotnet nuget push .\Kx.Toolx.Clicky.0.1.4.nupkg --api-key $ApiKey --source https://api.nuget.org/v3/index.json
正在将 Kx.Toolx.Clicky.0.1.4.nupkg 推送到 'https://www.nuget.org/api/v2/package'...
PUT https://www.nuget.org/api/v2/package/
warn : License missing. See how to include a license within the package: https://aka.ms/nuget/authoring-best-practices#licensing.,Readme missing. Go to https://aka.ms/nuget-include-readme learn How to include a readme file within the package.
Created https://www.nuget.org/api/v2/package/ 29282 毫秒
已推送包。

自动apikey

  • 给指定服务器保存ApiKey
nuget setapikey $ApiKey -source https://api.nuget.org/v3/index.json
  • 然后发布的时候可以省略ApiKey
nuget push .\Kx.Toolx.Clicky.0.1.4.nupkg -source https://api.nuget.org/v3/index.json