Nupkge Tool is the most practical and agile way to create or publish your Nupkg packages.
But, what are Nupkg files anyway?
If you are a developer that uses Visual Studio plataform, or any other IDE that uses Nuget Package Console to install packages in your projects, maybe you have asked yourself : how can I create my own packages to be available?
That's just what the Nupkg Tool does for you; it gives you the chance to create your own packages!
Basically, the Nuget Package Console reads the "*.nupkg" files that contain all the assemblies and references needed to publish it , and enables the installing on your projects.
After the Nupkg Tool installation, follow the steps below:
CREATING A PACKAGE (NUPKG)
- We're going to use as example the following project, that will be created and published having only the "Calc" class.
- Open Nupkg Tool following in : Tools > Nupkg Tool.
- Select in which project (*.csproj) the package will be created.
- After selecting it , click on “Generate Nuspec”.
- The Nuget Package Console will be open, it will do the constructing of the Nuspec file, and will be showed on the text box below.
- The Nuspec file is where all of your packages descriptions ( as name, version, description...), wil be.
- If necessary, you can edit the file by clicking on "Edit" button, to confirm your modifications you need to click on "Update" button.
- You can close the Nuget Package Tool, notice that the Nuspec content is already on the text box.
- Now, is just clicking on "Save Nupkg" to select the path where the Nupkg will be saved. (On the e.g. we'll save it on “C:\NupkgesLocal\”):
Done! Nupkg file created successfully!
ADDING NUGET PACKAGES PATH ON VISUAL STUDIO
- Packages created, now it's necessary to inform Visual Studio the path where this packages will be loaded.
- Follow the instructions : Tools > NuGet Package Manager> Package Manager Settings.
- Open "Options" tab, go to NuGet Package Manager > Package Sources session, and add the path where your packages are saved on the "+" button.
- Click on OK and done! Now you're able to find all package classes created by Nuget to install your projects, as the "Calc" class of the "AppSample" project as the example above.
NUPKG PUBLISHING
- Accessing Nupkg Tool, follow to Publish tab, and click on "Search" to find the Nupkg file that you want to publish.
- On “Source Configurations” area, select if you want to publish directly on "nuget.org" or on a Private Nuget server filling the needed information.
-Regardless of which one you'll choose, you still have to inform an API Key to publish it. ( You can generate your API Key on nuget.org)
- Inform your API Key of the account you, click on “Publish”.
* Nota: You can obtain your API Key on https://www.nuget.org/.
Done! Your package is already published!