views:

65

answers:

1

I need some help to create a msbuild script.

We are using TeamCity 5.1.2, VS2010 (.net 4.0) and TFS in our environment. We have a "SharedLib" folder in tfs where we put those dll's that are used by multiple projects.

What we do is that we have a database project that handles db access and when we build that, a post build event copies the output dll to the SharedLib folder. Our "client" projects reference that dll from the SharedLib folder.

What I want to do is that when I check in files from the database project into tfs, the build is started in teamcity. If the build is successfull, I want to check out the database dll from the SharedLib folder in tfs, update the file with the new version and check in that file to tfs again.

How can I write a msbuild script that does that for me?

+1  A: 

You can use the <EXEC $(TF) checkin ... /> command for that.

See http://blogs.msdn.com/b/nikhilsi/archive/2008/06/12/how-to-autoincrement-version-with-each-build-using-team-foundation-server-build-with-a-little-help-from-assemblyinfotask.aspx how you can use it.

Ewald Hofman
Thanks Ewald! A small follow up question: The TFS server and Teamcity build server are 2 separate servers. Is it possible to write a msbuild script that runs on the teamcity server and executes the tf.exe command on the other server? Or do I need to install tf on the build server?
OKB
You can work with conditions on the EXEC task. You could try the $(COMPUTERNAME) variable, although I am not sure if it works. If you run MSBuild with the Verbosity logging you will see all variables that are in use and you can use.TF is automatically installed when you install Team Foundation Build.
Ewald Hofman