Easily publish a NuGet package

I recently published WebAPI.Testing on Nuget but found it a bit tricky to build a package ready for NuGet.

There is documentation about how to do it but I found it hard to follow so I thought I’d document how I finally got my package ready.

The easiest way I thought was to have something built into Visual Studio. I spoke to David Fowler and he told me you can edit your *.csproj file and add <BuildPackage>true</BuildPackage> to it.

When you build your project a *.nupkg is created ready for publishing with NuGet.

However if you have no AssemblyInfo.cs or *.nuspec file then that package won’t contain anything that useful about your package.

So the easiest thing to do is amend your AssemblyInfo.cs file with information about your package if you have an AssemblyInfo.cs file. If you don’t have one its not a problem.

Build your project, open the *.nupkg file that was created with Nuget Package Explorer and edit the metadata adding any extra information you want about your project.

Note: If your solution has NuGet restore turned on the [...Read More...]