Requirements: In daily development, third-party library packages are often used, and this article will introduce creating a NuGet package from the .NET Standard library in Visual Studio on Windows and publishing it towww.nuget.orgAbove, make your plugin available to more .NET/C# developers.
Review:
NuGet.org Overview
NuGet.org is the public host for NuGet packages and is used by millions of .NET and .NET Core developers every day.
Sign up for a Microsoft account
To create a NuGet.org account, you need to have a Microsoft Personal Account (MSA) or Azure Active Directory (AAD) account. If you don't have an account, create one.
The hyperlink login is visible.
If you have already registered, visit the NuGet.org login page:The hyperlink login is visible.
Create a project
I created a .NET Standard library project using vs2019 as shown below:
In the project, write your own code, and that goes without saying.
Right-click on the item, select the Properties menu command, and then select the Packaging tab. As shown below:
According to the prompt information, fill in the corresponding text input box.
In the top toolbar, select the "Release" configuration, then right-click on the project, click "Package", and the output information is as follows:
1>------ Build started: Project: Sw.Core.Common, Configuration: Release Any CPU ------ 1>Sw.Core.Common -> C:\Users\DELL\source\repos\Sw.Core.Common\bin\Release\netstandard2.1\Sw.Core.Common.dll 1> Package "C:\Users\DELL\source\repos\Sw.Core.Common\bin\Release\Sw.Core.Common.Common.1.0.0.nupkg" has been successfully created. ========== Generated: 1 success, 0 failed, 0 latest, 0 skipped ========== Upload to NuGet
Using a Microsoft account, sign in to the NuGet app and authorize as follows:
Click Upload in the navigation bar, link:
The hyperlink login is visible.
Select "Sw.Core.Common.1.0.0.nupkg" for the release package we generated.
Pull to the bottom and click Publish.
The browser will be redirected to the link after the release was successful, and it will prompt that the package has not yet been published. It will appear in the search results and will be available for installation/restore once validation and indexing are complete. Package validation and indexing can take up to an hour. Read more.
Links after successful publication:
The hyperlink login is visible.
You can configure some instructions for the nuget package, modify the .csproj configuration as follows:
(End)
|