What is the best way to override the properties, items and targets defined in Tfsbuild.proj and Microsoft.TeamFoundation.Build.targets file? Additional how to pull all the customizations out of specific build type (Tfsbuild.proj) and make it available for all build types so as to reduce replication and make things more deployable?

 

You need to create project file (say customstuff.proj) and put all your custom properties, items and targets in this proj file. Then you can just import this file in your Tfsbuild.proj (similar to the way we are importing msft.tf.build.targets file in Tfsbuild.proj).

 

Additionally please make sure that you put the import statement towards the end of Tfsbuild.proj file (just above </Project> tag). This is because the last definition of property/target wins over earlier definitions. Thus if you are overriding properties defined in Tfsbuild.proj itself, it will be a good idea to add the import statement at the end of Tfsbuild.proj file