In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to use dotnet Cli to release packages to nuget". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
To make a long story short, today we share how to create and publish a .NET Standard package in nuget.org.
Front position
Install the Visual Studio; installation dotnet Cli of the checked .NET Core development kit
Starting with VS2017, dotnet Cli has been automatically installed in the .NET development suite; .NET Standard projects that use SDK-style format (the SDK property) require dotnet Cli;nuget.exe Cli for non-SDK-style projects (usually .NET Framework).
Create the. NET Standard library project configure package properties project right-click and select properties-> package
The packaging panel appears only in VS SDK-style projects, such as. NET Standard or .NET Core library projects.
Generate Nuget packages during build: as the name implies, in addition to packaging commands, nuget packages are also automatically generated during build.
Tags: help others locate your package and understand its capabilities.
Set a unique id for package and fill in other properties. Note that this package id needs to be unique across the nuget.org site. We recommend that you use the package prefix to avoid repetition, such as: ${UserName} .PackageName package change the configuration to Release right-click project-> package
If you don't see the packaging command, your project may not be a SDk-style-style project, which is to use nuget.exe Cli (or migrate to a SDK-style project and then use dotnet Cli).
Visual Studio builds the project and creates a .nupkg file, plugs in the output form, and gets the path to the package file. Release package
With the .nupkg file, you can get an API key from nuget.org (this Key marks your nuget account) and distribute the package in conjunction with dotnet cli.
To get the API Key login Nuget.org account, click your account name in the upper right corner, select API keys to create-- > Select range-- > Push, and enter * once you generate key, please Copy as soon as possible and save key. This key will be used in the dotnet Cli command.
Save your key as soon as possible. If you return to this page again, you need to regenerate key and Copy.
Release package
Change to the directory that contains the .nupkg file and execute the following command
Dotnet nuget push AppLogger.1.0.0.nupkg-k qz2jga8pl3dvn2akksyquwcs9ygggg4exypy3bhxy6w6x6-s https://api.nuget.org/v3/index.json
The following results are displayed:
Info: Pushing AppLogger.1.0.0.nupkg to 'https://www.nuget.org/api/v2/package'...
Info: PUT https://www.nuget.org/api/v2/package/
Info: Created https://www.nuget.org/api/v2/package/ 12620ms
Info: Your package was pushed.
Errors in push commands usually indicate a problem, such as:
You may have forgotten to update the version number of the project and try to release the same signed package. When you try to publish a package using an identifier that already exists on the host, you will also see an error: the name "AppLogger" already exists. Response status code does not indicate success: 403 (The specified API key is invalid
Has expired, or does not have permission to access the specified package.
If you confirm that you are using a valid API key, this error is inaccurate and is actually a naming conflict, which cannot be fully seen from the permissions section of the above error. Change the package identifier, rebuild the project, recreate the .nupkg file, and then try the push command again.
For other package management operations, please go back and forth in the nuget package management center.
This is the end of "how to use dotnet Cli to publish packages to nuget". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.