开发者

How can I get the list of properties that MSBuild was invoked with?

开发者 https://www.devze.com 2022-12-20 12:35 出处:网络
Given this command: MSBuild.exe build.xml /p:Configuration=Live /p:UseMerge=true /p:EnableUpdateable=false

Given this command:

MSBuild.exe build.xml /p:Configuration=Live /p:UseMerge=true /p:EnableUpdateable=false

how ca开发者_开发知识库n I form a string like this in my build script:

UseMerge=true;EnableUpdateable=true

where I might not know which properties were used at the command line.


What are you going to do with the list?

There's no built in "properties that came via the commandline" thing a la splatting in PowerShell 2.0

Remember properties can come from environment variables and/or other scripts.

Also, you stripped on of the params out in your example.

In general, if one is trying to chain to another command, one uses defaulting (Conditions on elements in PropertyGroups) and validation (Messages Conditional on presence of options) and then either create a new property or embed the params you want to pass into a string.

Here's hoping someone has a nice neat example of a more general way to do this but I doubt it.

As covered in http://www.simple-talk.com/dotnet/.net-tools/extending-msbuild/ one can dump out the parameters passed by doing /v:diag on the commandline (but that's obviously not what you're after).

Have a look in the Common.targets files - you'll find lots of cases of chaininign involving manaully building up lists to pass onto subservient tasks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号