house9

random code and what not

NAnt build with TFS changeset as revision number

This code sample is a nant script that
  • deletes the CommonAssembly.cs file (linked to all projects)
  • uses the nant asminfo task to recreate the CommonAssembly.cs file, but after we query TFS for the changeset (revision) number which is used in the version number
  • build the solution in release mode using the ide.exe (there are other - better ways, but this one works)
  • xcopy files to C:\temp\{app} and clean up all the source files

basically I just put together a few bits that I found on other blogs (should have saved the urls - doh!), most were related to using svn for source control and then I added in the code block for the c# stuff to query TFS.

A quick note about the linked CommonAssembly.cs file, visual studio has an option when you are adding an existing file to a project to select ‘linked’, click the arrow on the ‘Add’ button when you select your existing file

what this script does not do - get latest from TFS, I usually do that part manually or from ccnet



the c# bit that goes in the nant script block above
NOTE: see updated version of this code block



nant is awesome!

Comments

juho
Seems that this solution doesn't work with TFS2010, but thanks for the idea, I'll use it as a base for my project :)
Mahendra Mavani
I was looking for this solution, since long. Thanks for providing this sample. It works great on my project