80
votes

I have a TeamCity server setup to do my CI builds. I'm building and testing a C# solution and running some custom MSBuild tasks. One of these tasks is printing a warning in my build output...

MSBuild command line parameters contains "/property:" or "/p:" parameters. Please use Build Parameteres instead.

I don't understand what this means or how to remove it. It doesn't Google well (with or without the typo). I ran the task from the command line (with /verbosity:diagnostic) and it doesn't appear, so I believe it's a TeamCity message.

The MSBuild task is

<Target Name="InstallDb">
  <MakeDir Directories="$(DbPath)" />
  <Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseDrop.sql" />
  <Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseCreate.sql -v DbPath=&quot;$(DbPath)&quot;" />
  <Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseProgrammability.sql" />
</Target>

And the relevant TeamCity step information is

MSBuild version: 4.0
MSBuild ToolsVersion: 4.0
Run platform: x64
Targets: InstallDb
Command line parameters: /property:DbPath=%env.DB_PATH%

2
@AnneTheAgile you simply add a TeamCity System Build Parameter. It's one of the 3 types of build parameters you mentioned. You name it like 'system.<name-of-my-build-parameter>' and provide the value that you want. TeamCity will automatically send it to MSBuild. You can check the value of the parameter in the build report. There's a tab for parameters where they all get listed.Anthony Mastrean

2 Answers

58
votes

You have to add Build Parameters under Properties and environment variables in the configuration

`enter image description here

So in the command line parameters in the Build Step for MSBUild, remove any property that is specified as /p: and add each of those to the Build Parameters ( screenshot above) and give the values

39
votes

It all happens behind the scenes! You just have to follow the right conventions. In your MSBuild script, you use the regular variable notation

$(DbPath)

And in TeamCity, you define a system or env variable

system.DbPath

TeamCity will automagically send all of its system/env variables to your MSBuild task, removing the 'system' or 'env' part. And you don't have to write /property:DbPath=system.DbPath in your TeamCity task.