MSBuild optional WithProperty #3383
-
I have a MSBuild statement, but for Something like Is this possible, actual code is below: MSBuild(BuildParameters.SolutionFile.ToString(), configurator => configurator
.SetConfiguration(BuildParameters.Configuration)
.WithProperty("Platform", BuildParameters.Platform)
.SetVerbosity(Verbosity.Normal)
.WithProperty("BuildIpa", "true")
//.WithProperty("AndroidBuildApplicationPackage", "true")
//.WithProperty("Project", "appname.Android")
.WithProperty("CodesignKey", BuildParameters.CertTypes[BranchProject].IOSTeam)
.WithProperty("CodesignProvision", provisionType)
.WithProperty("MtouchNoSymbolStrip", "false")
.WithProperty("ArchiveOnBuild", "true")
.WithLogger(
Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath,
"XmlFileLogger",
$"logfile=\"{BuildParameters.LogPath}\";verbosity=Detailed;encoding=UTF-8"
)
); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 .WithProperty("AndroidBuildApplicationPackage", isAndroid ? "false" : "true") You can see a similar example here. Otherwise, you'd need to create an instance of e.g. var settings = new MSBuildSettings();
settings.WithProperty("Platform", BuildParameters.Platform);
// etc.
if (isAndroid)
{
settings.WithProperty("AndroidBuildApplicationPackage", "true");
}
MSBuild(BuildParameters.SolutionFile.ToString(), settings); |
Beta Was this translation helpful? Give feedback.
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: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 theMSBuild
overload that takes an instance ofMSBuildSettings
.e.g.