UserVariableComponent

Support of dynamic variables via User-Variables core.

Syntax:

#[var name]
#[var name = mixed value]

Samples:

#[var branchSha1 = #[File sout("git", "rev-parse --short HEAD")]]
#[var ver = #[var ver].#[var revBuild]]

Operations

v0.11.3+

Unset variable

Operator the '-'(minus). Use this as first symbol for variable name that must be removed:

#[var -name]

Default value for variable

You can use this for re/definition variable with default value for compatibility with variables from MSBuild core.

Operator the '+'(plus). Use this as first symbol for variable name that must be re/defined by default:

#[var +name]

Examples

Empty string

Allowed in v0.11.3+

#[var name =]

For older versions - you should use 1 or more symbols (whitespace characters or any other value), for example:

#[var name = ]
  • you can trim this if needed later with MSBuild

Whitespace characters for values

The all variables should skip the first whitespace characters to set values for compatibility. However, you can use the MSBuild core and static methods, for example:

Example - only 5 whitespace character as value:

#[var name = $([System.String]::Concat("     "))]

Other:

#[var name = $([System.String]::Concat("  ")) mixed value]
#[var name = $([System.String]::Format("{0} - {1}", "      ", "test"))]

You can escape evaluation of this sequence with a '$' symbols if needed.

Or you can use MSBuild core for work with User-Variables, for example:

$(name = " ")
$(name = "  - Platform is a $(Platform)  ")

For more details: see MSBuild page

References