Creating a NuGet package

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]

  1. Open a PowerShell command prompt and CD into your project folder where your .csproj file lives.
  2. type nuget spec
    1. You might have to do:  nuget spec -f  to overwrite an existing nuspec file.
  3. 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.
  4. Some things in .nuspec don’t have attributes in the Assembly.cs file, so you’ll have to manually enter them, such as:
    1. Update text
    2. Tags
  5. Save the .nuspec file.
  6. From the PowerShell command line, type:  nuget pack MyProjectName.csproj
    1. or nuget pack MyProjectName.csproj -IncludeReferencedProjects  to make sure it includes the stuff it references.
  7. 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.