How To Provide Additional Data To MSBuild From TeamCity

Command Line

If you run MSBuild from the command line, you can use the “property” injector command line argument. This is basically a key value pair.

e.g. C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe <PathToMSBuildProjectFile> /t:Run /p:Configuration=Release /p:Property1=Value1



You can use the same construct also in TeamCity:



The problem arises if you have

  • more than one build step in a build configuration
  • more than one build configuration

which all use the same parameters.

Use Build Parameters

TeamCity provides the support of build parameters (

With this approach, the build parameters are automatically provided to the MSBuild command line. You have to use System Properties to achieve this goal:


Where to put Build Parameters

There are two possiblities where to put them:

  • build configuration
  • build project

Build Configuration

If you put the build parameters to Build Configuration, they are for this build configuration only.


Build Project

If you add the build parameters to the BuildProject, they are “inherited” by all build configurations of this project.



If one or more of the parameters are different for a build configuration, you can still overwrite it in the build configuration’s Build Parameters:



Welcome to my WordPress Blog site.

After I attended Let’s Test conference in 2013, I was really impressed by the openness of the attendes about sharing their experience and thoughts. With this site, I would also like to share mine and hope I can help someone else as well.