msbuild -p option

msbuild -p option

本宫微胖 发布于 2021-11-28 字数 632 浏览 907 回复 2 原文

We could use msbuild to build project from command line. My question is about -p option. This option is used to specify property key/value pairs. My question is, besides the key/value pair assigned by -p option from command line, any other already existing defined options? If there are such existing defined options, where are the existing options defined and how such key/value pairs are used during build process?

For example, command like msbuild foo.sln /p:Configuration=Debug, besides option Configuration (whose value is Debug), are there any already defined existing options?

thanks in advance,

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


淡写薰衣草的香 2022-06-07 2 楼

The properties will vary from project type to project type but here a list of typical ones for .NET projects with example values:

  • Configuration: Debug, Release
  • Platform: x86, x64, Any CPU
  • Optimize: true, false
  • OutputPath: binDebug, binRelease
  • NoWarn: 1591 (suppress missing XML documentation warning)

To see all the other properties used during a build you can open up the common MSBuild targets located in the Framework directory: C:WindowsMicrosoft.NETFrameworkv4.0.30319. Check out Microsoft.Common.targets and Microsoft.CSharp.targets for C# project build properties.

If you want in-depth coverage of MSBuild I recommend reading Inside the Microsoft Build Engine or MSBuild Trickery. If you already know the basics though I would skip the first book. You can get basic tutorials for MSBuild online.

忆沫 2022-06-07 1 楼

See MSBuild Reserved Properties and How To: Use Environment Variables in a Build, since these are kinda properties too.