All of the code samples have now been consolidated and moved to my blog at Many google searches still point here so I am leaving this blog operational.

Sunday, April 20, 2008

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

nant is awesome!

1 comment:

Mahendra Mavani said...

I was looking for this solution, since long. Thanks for providing this sample. It works great on my project

Custom Search
< ... back