Pack our asp.net core class library and publish the package (Class Library) to nuget platform for management by using the one click package function provided in VS

Time:2020-2-12

This chapter will share with you how to pack our asp.net core class library and publish the package (Class Library) to nuget platform for management by using the one key packaging function of vs.

1、 Register and log in to nuget platform

Nuget website: https://www.nuget.org/

Here I use the Microsoft account for associated login

After you log in successfully, you can manage your personal information. I won’t describe it too much here

2、 Package asp.net core class library

Mode 1: use the one button packaging function provided in vs (recommended)

The advantage of this approach is that the dependencies of the class library are packaged with XML information, take vs2017 as an example, the packaging process is as follows:

First, you need to set the package version of the class library, the author and other related information. Click item = > Right Click = > select attribute as follows:

 

Then select the generate tab and check the XML document file. Only in this way can the XML information be packaged together

Then select the package tab and fill in the package related information as follows:

Remember to save and rebuild after setting

Finally, one click packing is needed. Click item = > Right Click = > select packing, as shown below:

After successful packaging, a package file of type. Nupkg will be generated in the \ bin \ debug directory of the project, as follows:

Add: if you check generate nuget package in version when setting package related information, the nuget package will be regenerated every time you generate a project.

Remember to save and rebuild after setting

At this time, you do not need to right-click the package operation. When the regeneration is successful, a package file of type. Nupkg will also be generated in the \ bin \ debug directory of the project, as shown below:

3、 Publish package (Class Library) to nuget platform

Mode 1: directly upload the package file of type. Nupkg just generated

After successful upload, you can click Submit directly. Of course, you can also improve the relevant information before submitting.

Finally, wait for a few minutes, and you can see the information about the newly released package in nuget platform, where you manage the package.

When you see that the status of the published package is listed, you can find it in vs where the nuget package is managed, as follows:

4、 Delete nuget package

Relevant information:
https://docs.microsoft.com/zh-cn/nuget/nuget-org/policies/deleting-packages

At present, it seems that it is not supported to permanently delete the package uploaded to nuget platform, but only to set its display status as invisible, as shown below:

It will take several minutes after saving.

So far, this chapter is finished. If you think this article is helpful to you, please remember to like it and pay attention to it. Thank you!!!

 

Reference: https://www.cnblogs.com/fei686868/p/12120579.html

Copyright notice: if there is any similarity, it is a coincidence. If there is any infringement, please contact me in time for modification. Thank you!!!