Passing Dynamic Properties in TFS

Scenario: You have a TFS.proj file that builds a solution file and you want to pass a dynamically generated property to the solution file you are building. Eg  it could be the version number that had to be passed over to the solution / say web deployment project. 

<SolutionToBuild Include="MySolution.sln">
      <
Properties>Version=$(Version)</Properties>
    </
SolutionToBuild>

The above code snippet will not work .Instead you have to  make use of the CustomPropertiesForBuild  reserved property and do something like this

<PropertyGroup> <CustomPropertiesForBuild>$(CustomPropertiesForBuild);Version=$(Version)</CustomPropertiesForBuild> </PropertyGroup>

This will ensure that the property Version is passed on to every solution that the Team foundation Build calls.

If you want to  pass custom properties into every solution when the TFS Build calls the Clean Target then you should be using the reserved property CustomPropertiesForClean

See this post for some more info

2 Comments

Comments have been disabled for this content.