Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity says to use "Build Parameters" instead of "/property:" in an MSBuild step. What does that mean?

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%

like image 928
Anthony Mastrean Avatar asked Jun 02 '11 18:06

Anthony Mastrean


People also ask

What are parameters in TeamCity?

Last modified: 19 July 2022. Build parameters are name-value pairs, defined by a user or provided by TeamCity, which can be used in a build. They help flexibly share settings and pass them to build steps.

How do you set building steps in TeamCity?

In Build Steps, click Auto-detect build steps, and then select the proposed steps you want to add to the current build configuration. You can change their settings afterwards. When scanning the repository, TeamCity progressively searches for project files on the two highest levels of the source tree.

What is build ID in TeamCity?

teamcity.buildType.id. none. The unique ID used by TeamCity to reference the build configuration the current build belongs to.


2 Answers

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

like image 121
manojlds Avatar answered Oct 12 '22 01:10

manojlds


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.

like image 37
Anthony Mastrean Avatar answered Oct 12 '22 03:10

Anthony Mastrean