views:

215

answers:

2

We have a particular file, say X.zip that is only modified by 1 or 2 people. Hence we don't want the build to trigger on every check-in, as the other files are mostly untouched.

I need to check for a condition prior to building, whether the checked-in item is "X.zip" or not.. if yes, then trigger a build, else don't. We use only CI builds.

Any idea on how to trigger the build only when this particular file is checked-in? Any other approaches would be greatly appreciated as i am a newbie in TFS...

Tara.

A: 

I don't know of any OOTB feature which can do this, what you would need to do is write your own custom MSBuild task which is executed prior to the build running (pre-build action).

The task will then need to use the TFS API to check the current check in for the file you want and if it's not found you'll have to set the task to failed.

This isn't really ideal as it'll indicate to Team Build a build failure, which, depending on whether you're using check in policies, may be unhelpful. It'd also be harder to at-a-glance work out which builds failed because of the task and which failed because of a real problem.

You can change the build to occur less frequently rather than every check in, which will reduce load on your build server.

Otherwise you may want to dig into Cruise Control .NET, it may support better conditional builds.

Slace
thanks for the reply..yes you are right.. and yes we can make sure the build doesnt run for every check-in which is exactly wat i want.. its just that i don't know how to access the checked in file and/or its path and use that conditionally in a pre-build event.. isn't it possible to mention this condition in the "SolutionsToBuild" property or somethin like that in the build script?
A: 

If you could move X.zip into it's own folder, then you could set up a CI build with a workspace that only looked at the folder containing X.zip.

You would then need to add an explicit call to tf get to download the rest of the code as Team Build only downloads what the workspace is looking at.

But this might be simpler than the custom task approach?

Ross Johnston