foreword
I wrote an article earlier on how to package your own assembly into a nuget package and upload it to nuget.org, the portal . All operations are performed through the web page. Now, a more convenient and quick way to upload is to use the dotnet cli command.
Create API Key
We need to apply for an API Key to nuget, and then we need to use it when uploading the package to pass the authentication of nuget.
1. Click on the upper right cornerAPI Keys
2. Enter the information as shown in the figure below to create a Key
3. Click Copy
to copy our key
Change package version
We then use the project created in the previous article, change the version number, and then package it
Packaged successfully:
You can see that there is a version 1.1 that we just created
upload
Open cmd, cd into the directory where the package is located, and execute the following command
dotnet nuget push <你的包路径> -k <你的key> -s <需要发布的包源地址>
The release is successful as shown in the following figure:
We open nuget and we can see that we already have the 1.1 version we just uploaded