Skip to content

MSBuild optional WithProperty #3383

Discussion options

You must be logged in to vote

There's nothing built-in at the moment that would give you a predicate to decide to add (or not) a property.

Is there any value of AndroidBuildApplicationPackage that would have the same effect as not having the property at all? e.g. false? If so, you could do something easy such as:

.WithProperty("AndroidBuildApplicationPackage", isAndroid ? "false" : "true")

You can see a similar example here.


Otherwise, you'd need to create an instance of MSBuildSettings, call (or not call) WithProperty based on the condition/variable and then use the MSBuild overload that takes an instance of MSBuildSettings.

e.g.

var settings = new MSBuildSettings();
settings.WithProperty("Platform", BuildParameters.P…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nick5454
Comment options

Answer selected by nick5454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants