Share →
Buffer
Bryon Root on Visual Studio ALM

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

Prerequisite

Have a Octopack installed in the application.

Solution

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
image

 

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

image 

Enter the following code | click  OK

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

Figure 3

image

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

image

 

Conclusion

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

Print Friendly
Tagged with →