views:

370

answers:

3

I'm finishing setting up a TFS Build definition and having problems with getting MSBuild to run any code that I've put in the Custom.After.Microsoft.Common.Targets file. The file is definately in the right place, and is definately being parsed (breaking the syntax in the file causes build errors), but none of the code in it gets run. I've put the exact same code in the TFSBuild.proj file, and it works fine. All the correct targets get over-written etc. Any ideas what's causing this?

A: 

This may be a stupid question but you placed that file in the right location on the build server right?

Sayed Ibrahim Hashimi
Yeah, it's on the build server and is definately being parsed, as breaking the syntax by removing a > causes errors.
Barn
A: 

Remember evaluation priority; If an item or property is set then it won't be overwritten in a latter include except where you call CreateProperty or CreateItem tasks. I found that this stopped me from running conditional tasks.

Set verbosity to 'diag' to see what gets evaluated on the server build when including.

Preet Sangha
My bad, i meant to put Custom.After.Microsoft.Common.Targets (which I've now corrected), so the evaluation order shouldn't be a problem.
Barn
A: 

OK, it actually did turn out to be the evaluation order, but not how we expected. The property group for DropBuildDependsOn was extended by us, but was then overridden later on by the TeamFoundation targets file. WE instead modified this file to import our project as well and it now all works.

Barn
well done. Good idea to post your as answer!
Preet Sangha
You should place your overrides after the Import statement for the TF targets file.
Sayed Ibrahim Hashimi