directory

Create and get API Keys on NuGet

1. You need to log in first, directly log in with Microsoft account

2. Click API Keys in the upper right corner to create a Key

3. Fill in the information

4. Get the Key

Second, create a project

1. Create projects

2. Generate DLL

3. Create a publishing folder

Third, upload NuGet

1. Upload the file using the cli

2. Publish using NuGet Package Explorer

Iv. NuGet package management

1. Management package

2. Delete the

Create and get API Keys on NuGet

Website: www.nuget.org/

1. You need to log in first, directly log in with Microsoft account

2. Click API Keys in the upper right corner to create a Key

3. Fill in the information

I directly fill in the project Name as the Key Name

4. Get the Key

Click the Copy button to get the Key

Second, create a project

1. Create projects

The Framework uses.net Framework 4, which will also be used later, and the output type uses the class library

2. Generate DLL

After completing the project, use the Release mode to generate the DLL

3. Create a publishing folder

For better file management, create a winform. MoveControl folder in E:\nuget to store the files you need

Description:

PNG file, used as the nuget package Icon, found that JPG is not supported, only PNG can be used

The readme.md file, the introduction file, will be inwww.nuget.org/packages/Wi…According to

Winform.movecontrol. DLL file, project file

Third, upload NuGet

There are two ways to upload NuGet

1. To use the command line to upload files, you need to download nuget

2. Use the interface tool to upload, you need to download NuGet Package Explorer

1. Upload the file using the cli

1.1 towww.nuget.org/downloadsDownload the nuget. Exe

1.2 Configuring nuGET Environment Variables

Put the downloaded nuget.exe in E:\nuget

Open computer Properties – Advanced System Settings – Environment Variables – System Variables, select Path- Edit – New – fill in E:\nuget, ok

With the environment variables configured, you can use the Nuget directive

1.3 Generating the NUSPEC File

Use the nuget spec command to produce.nuspec files in XML format

<? The XML version = "1.0"? > <package > <metadata> <id> package </id> <version>1.0.0</version> <authors>GreAmbWang</authors> <owners>GreAmbWang</owners> <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl> <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl> <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Package description</description> <releaseNotes>Summary of changes made in this release of the package.</releaseNotes> <copyright>Copyright 2021</copyright> <tags>Tag1 Tag2</tags> <dependencies> <dependency Id ="SampleDependency" version="1.0" /> </dependencies> </metadata> </package>Copy the code

The information inside can be modified. I am not used to this way. The parameters inside will be described below

1.4 Generating nupKG files

Produce.nupkg files using the nuget pack command

1.5 Upload to Nuget

Use function commands directly

Nuget push Package. 1.0.0. Nupkg xxxkey - Source https://api.nuget.org/v3/index.jsonCopy the code

In this way, the upload is complete, or the second method, more recommended second method

2. Publish using NuGet Package Explorer

2.1 Download NuGet Package Explorer

www.microsoft.com/zh-cn/p/nug…

NuGet Package Explorer can directly open a file in nupkg format

2.2 Refer to Log4NET for formatting

Let’s just open up a published Nuget and look at Log4Net

Use NuGet Package Explorer to open, you can refer to the compilation inside

2.3 Creating a new Package

2.4 Adding a Lib folder

2.5 Adding a Net40 Folder

2.6 Adding existing Files

Add good files, that’s right

2.7 Editing uploaded Data

I select Edit Metadata, and the Edit Metadata Source is in XML file format

Fill in the information

You also need to add project dependencies, which frameworks to rely on for example. NETFramework, NETStandard etc

Let’s see what it looks like

The XML format in the Edit Metadata Source looks like this

<? The XML version = "1.0" encoding = "utf-8"? > <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <metadata> <id>WinForm.MoveControl</id> < version > 1.0.5 < / version > < title > WinForm. MoveControl 1.0.5 < / title > < the authors > GreAmbWang < / the authors > <owners>GreAmbWang</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <icon>Icon.png</icon> <projectUrl>https://greambwang.blog.csdn.net/article/details/118424770</projectUrl> <description>WinForm.MoveControl Can set control drag, adjust control size and position. It is very simple to use, executing a single line of code, such as button1.setmove (); </description> <summary> Set WinForm control drag, Release 1.0.5</releaseNotes> <copyright>Copyright © 2021 GreAmbWang</copyright> <language>zh-Hans-CN</language> <tags>GreAmbWang, WinForm</tags> <readme>readme.md</readme> <dependencies> <group targetFramework=".netframework4.0 "/> </dependencies> </metadata> </package>Copy the code

Save the NUPKG file

file

2.8 Publish to Nuget

Enter the key at nuget.org

Once it’s posted, it needs to be reviewed, and it takes about two minutes

Install on NuGet

Haha, done

Iv. NuGet package management

1. Management package

NuGet Package Explorer,nuget.org, and NuGet

2. Delete the

The Nuget package cannot be deleted, but the corresponding version is hidden

Uncheck unwanted versions in Listing and they won’t show up in NuGet search

The wrong package can be set by hiding the version

This is one of my last projects

WinForm.MoveControl

Can set control drag, adjust control size and position. It is very simple to use, executing a single line of code, such as button1.setmove ();

Project article introduction:

Greambwang.blog.csdn.net/article/det…

GitHub:github.com/GreAmbWang/…

Nuget:www.nuget.org/packages/Wi…

reference

Blog.csdn.net/qq_35260798…

Docs.microsoft.com/zh-cn/nuget…