This is a short and dirty post, which does NOT cover every possibility. This post assumes you’re done writing and testing your project and are now ready to deploy as a NuGet package, that you’re on a Windows PC, and are using Visual Studio.
[GARD]
- Open a PowerShell command prompt and CD into your project folder where your .csproj file lives.
- type nuget spec
- You might have to do: nuget spec -f to overwrite an existing nuspec file.
- Edit the *.nuspec file created and change the variables you need. Note that the ones with $stuff$ are pulling from your Assembly.cs file. Edit your Assembly.cs file to have the right stuff so you don’t have to re-enter it every time here.
- Some things in .nuspec don’t have attributes in the Assembly.cs file, so you’ll have to manually enter them, such as:
- Update text
- Tags
- Save the .nuspec file.
- From the PowerShell command line, type: nuget pack MyProjectName.csproj
- or nuget pack MyProjectName.csproj -IncludeReferencedProjects to make sure it includes the stuff it references.
- Now, copy your package file to your nuget repository and it should be available to other developers from within Visual Studio’s NuGet package manager.