Wednesday, December 2, 2015

MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead

I recently needed to pass some additional parameters to my Visual Studio build in TeamCity and I passed the parameters in the Visual Studio Build Step as follows:


As you can tell from the above screenshot, I was passing traditional command-line parameters to MSBuild (/p:PublishProfile=Release /p:DeployOnBuild=True) when I suddenly encountered the following error message in the build log:

MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead

Well, the error message was very cryptic and an Internet search did not return any useful results with solutions.

Fortunately, though I found this article which hinted at the solution: https://johanleino.wordpress.com/2013/03/19/using-teamcity-for-asp-net-development-part-2/

I then read this TeamCity article: https://confluence.jetbrains.com/display/TCD9/Defining+and+Using+Build+Parameters+in+Build+Configuration

This informed me that TeamCity automatically passes all System Parameters to the Build Configuration without any additional effort.  Of course, this ultimately led me to the conclusion that I simply needed to define System parameters in my Build Configuration for PublishProfile and DeployOnBuild (my MSBuild Command Line Argument properties) and ignore passing any values on the command line whatsoever!

This is what finally worked for me:




No comments:

Post a Comment