How do I pass this common property to MSBuild using TeamCity?

后端 未结 4 907
半阙折子戏
半阙折子戏 2021-02-19 06:10

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

/Property:FileAlignment=4096

I

4条回答
  •  失恋的感觉
    2021-02-19 06:59

    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".

提交回复
热议问题