NOTE: This functionality will be baked into a future release of NuGet command line (it's already in the codebase) and therefore I suggest you do not use this project!

Project Description

NuGet.Versioner makes it a snap to automatically produce versioned NuGet packages by extracting version information from your .dll or .exe during Visual Studio Post-build events.

2 Minute Usage Tutorial

Step 1

Using the NuGet Package Manager Console, Install NuGet.CommandLine in your project.

PM> Install-Package NuGet.CommandLine

Step 2

Using the NuGet Package Manager Console, Install NuGet.Versioner in your project.

PM> Install-Package NuGet.Versioner

Step 3

Add a .nuspec manifest file to your project root and set its "Copy to Output Directory" property to "Copy Always"

NOTE: NuGet.Versioner currently extracts version information from the first .dll or .exe listed in the <files> section of the .nuspec manifest. Also, be sure to leave the <version> element empty when entering information in the manifest file. NuGet.Versioner inspects this element when updating the version and will not overwrite an existing value.

Step 4

Update your project's Post-build event definition to below, where package.nuspec is the name of the .nuspec file you added to your project.

if $(ConfigurationName) == Release (
    NuGet.Versioner.exe "$(TargetDir)package.nuspec"
    NuGet.exe pack package.nuspec

Step 5

Anytime you want to create an updated NuGet package, change your build configuration to "Release" and rebuild - the versioned package will be in your bin\Releases folder!


  • Remove the need to specify $(TargetDir) when invoking NuGet.Versioner.exe from Post-build event.
  • Transition NuGet.Versioner to NuGet.exe command-line plug-in?

Last edited Mar 21, 2011 at 12:08 AM by rjygraham, version 8