I am using the TeamCity Visual Studio runner. I want to add a setting that is not accessible from Visual Studio.


I typed that directly into the build step "Command line parameters." The build log shows the error:

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

I don't understand how to provide this to MSBuild from TeamCity and get rid of this warning!

1. Which kind of parameter should I use?

There are 3 kinds:

  • Configuration parameters
  • System properties
  • Environment variables.

I don't want an environment or system variable because I don't want this build to depend on anything external. I am going to try Config right now, but then I'm not sure I'm filling it in right.

2. How can I tell this parameter is actually getting used?

The build log, which seems only to have navigable/foldable xml-like levels with their program, did not say the build parameters.

  • That was the item on which I originally added my question as a comment. My question was not answered there. Was I not clear? And/or am I supposed to post a question as an "answer" there? – AnneTheAgile Jan 11 '12 at 14:37
  • hi Anthony, thank you! I decided my question was different because I am not trying to get the variable to substitute inside an msbuild pre/post build script but rather pass to the commandline of msbuild itself. Because this particular command yields small results, it will be hard for me to verify its working. I was thinking maybe I should at least first try an option that's a bit more obvious to see if it 'takes'. But still I'm not sure how to do that... (Thus, it seemed to me this question was not a mere detail, but maybe I am wrong.) – AnneTheAgile Jan 11 '12 at 17:36

You should use "System properties". Don't worry about the name, that's just how TeamCity calls it. They are regular properties. You can add them in "Edit Configuration Settings > 7. Build Parameters".

For example, you can add the system property as follows:

Name: system.FileAlignment

Type: System property (system.)

Value: 4096

Note that TeamCity will insist on the "system." prefix. It doesn't matter because the MSBuild script will still see it as $(FileAlignment).

  • This confused the heck out of me until I realized that "Configuration Parameters" are NOT "System Properties" (they don't have the .system prefix). You can easily create a "System Property" from a "Configuration Parameter" if need be. – Dave Andersen Feb 28 '14 at 22:16

The TeamCity documentation defines Build Parameters as "a convenient way of passing generic or environment-specific settings into the build script". Configuration parameters provide a way to override some settings in a build configuration inherited from a template. They are never passed to a build. System and Environment parameters are provided to your build script. Environment variables are actually set on the system (I can't find any documentation for this). System parameters are passed to the script engine.

TeamCity automatically provides System variables to the actual command line (it looks like the Visual Studio runner runs msbuild.exe and not devenv.exe). I guess that TeamCity is constructing a command like

cmd> msbuild.exe my-solution.sln /p:FileAlignment=4096

I tried this on my command line, just to make sure that it should work (I added the /v:diagnostic flag). The diagnostic verbosity makes msbuild print all of it's properties to the console. I verified that FileAlignment=4096 was in there.

That /FileAlignment property appears to be a special property that's automatically in any .csproj file. So you should be good to go. You can check the actual parameters that were passed to the build by clicking on any build and viewing the 'Build Parameters' tab. There's a section that shows the "Actual Parameters on Agent".

up vote 1 down vote accepted

This was solved. To clarify, Anthony told how to solve the problem in the commandline using MSBuild. It can also be solved on the commandline using devenv, per a ticket with Microsoft, the syntax is:

 devenv ..\..\mysolution.sln /Rebuild /Property:Config=Release;Platform=AnyCPU;Filealignment=512

What I wanted, however, was to get Teamcity's "Visual Studio Build" to accept the parameter. This was achieved as follows. In the box for Command line parameters, I entered:

/Property:FileAlignment=filealignment v:diag

Then the output tab for Build Parameters shows:

User Defined Parameters
Name                    Value passed to build
system.filealignment    512
system.verbosity        diagnostic

(This is -754 chars for a comment so must be typed as a post)

hi Anthony, Thank you for replying! Yes, msbuild on the commandline works fine for me as well and project files may store FileAlignment properties. In our case, upon discussion with Microsoft, it appears necessary that I specify the solution-wide aka build-wide alignment, ie in the command arguments, in addition to fixing the projects (which I have already done).

No parameter that I specify on the GUI item ( /Build Step / Command line parameters/ ) will appear on the tab /Build Parameters/. Of course some will not compile at all.

Also I have even more weird behavior where using /verbosity:diagnostic vs /verbosity:minimal causes a longer build log for the minimal! It appears diagnostic is hiding the details inside of a special task, which is part of Teamcity and not me; [16:24:05]: Overriding target "SatelliteDllsProjectOutputGroup" in project "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets" with target "SatelliteDllsProjectOutputGroup" from project "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.WinFX.targets". I am struggling with this because the Teamcity-generated build output log is so nice to have as a TreeView. That works with the SLN build but using any bat file cannot produce log file with the pretty (xml, presumably) tree-format.

If you have further ideas I will love to hear them, and thank you for your edits! :)

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.