amateur
amateur

Reputation: 44673

Increment version during publishing and check in to Team Foundation Server (TFS)

I am at present setting up my ASP.NET MVC 4 web application with publish profiles and the associated publishing features. My continuous integration (CI) environment is Team Foundation Server (TFS) build 2010 and TFS for source control.

I have a number of requirements that I would like to achieve with this. Firstly, each time I create the publish package for release, I would like the build number to be incremented and revision number reset to 0 in my version file. I currently have one version file that contains the version number of Major.Minor.Build.Revision. So I would like the creation of the publishing package to do such. Is this possible and if so how is it achieved? Note as this increments the version file, as part of this process I would like this checked in to source control.

My second question is that each time a developer checks in to the TFS build server, the revision number will get incremented or at least changed to a new value. I had hoped to update my build template to achieve this, but unfortunately due to restrictions on my build server I can not incorporate any custom activities on it. So I am looking to perform this task with MSBuild. Is it possible to achieve what I outlined here with MSBuild and if so, could I get an explanation please?

Upvotes: 3

Views: 1735

Answers (3)

i100
i100

Reputation: 4666

Look at these Stack Overflow answers to Working automatic build increment Visual Studio addin and Auto update version numbers (C++ / C#) in Visual Studio 2005.

I hope you'll find the solution. ProjectBuildCounter is an independent stand alone that might be attached to a project as well as a TFS event handler.

Upvotes: 0

Ewald Hofman
Ewald Hofman

Reputation: 12668

It is an old blog post, but it might still work: How To: Update Assembly Version Numbers with MSBuild.

Upvotes: 0

Holistic Developer
Holistic Developer

Reputation: 2536

The Team Foundation Build Customization Guide has 10 pages on this topic (a little too much to duplicate here). This guide is produced by the Visual Studio ALM Rangers and is about as close as you can get to official guidance.

Upvotes: 0

Related Questions