views:

30

answers:

1

Given this command:

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

how can 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.

+1  A: 

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.

Ruben Bartelink
"There's no built in "properties that came via the commandline" thing a la splatting in PowerShell 2.0"Ok, I understand. Thanks!
michielvoo
@michielvoo: [Not 100% sure whether you're serious about that - if you are, maybe you should have FizzBinned and I could have made it that brief in the first place!] Not sure why I thought that would have meaning for anyone that doesnt listen to PowerScripting. BTW If you dont have it already, get the Inside MSBuild book - its fantastic.
Ruben Bartelink