Inserting a Team Build number into the Octopack "Run Version" for a NuGet package

By | 2013-05-08T12:01:36+00:00 May 8th, 2013|Team Foundation Build, Tools, Visual Studio ALM|0 Comments

The Octopack does not auto generate a version number that is the same as the TFS Team Build number for a .nupkg package.

Applies to

  • Team Foundation Server 2012 (TFS)
  • NuGet
  • Octopack


Have a Octopack installed in the application.


In the default team build definition template | Open the Run MSBuild for Project activity located under: 

Run on Agent > Try Compile, Test, and Associate Changesets and Work Items >  Sequence > Compile, Test, and Associate Changesets and Work Items > Try Compile and Test > Compile and Test > If BuildSettings.HasProjectsToBuild > For Each Configuration in BuildSettings.PlatformConfigurations > Try to Compile the Project >  Compile and Test for Configuration > Run MSBuild for Project

Figure 1


Right click on the Run MSBuild for Project | Select properties in the menu window

In the Run MSBuild for Project properties | Click on the CommandLineArgument eclipse button | The Expression Editor will open

Figure 2


Enter the following code | click  OK

 /p:SkipInvalidConfigurations=true {0}  /p:OctoPackPackageVersion={1}

Figure 3


Check-in the update to source control | Run a build where Octopack is installed

The .nupkg will have the same name and build number as the Team Build

Figure 4




Using the above method will allow you to add global types of MS Build arguments in a default build template.  You can also mask a user name and password if you don’t want everyone to view the information.

For the Octopack and NuGet versioning you can also add the TFSVersion custom build activity. Finally, you can also use the NuGetter custom build activities if Octopack does not fit well with your project. 

Additional resources

About the Author:

Leave A Comment