Skip to content

XAML PreBuild script

Codeblack edited this page Mar 12, 2017 · 2 revisions

This is a script that is to be used as the pre-build script in a build-workflow. It uses the Update-Version function to update the version-attributes in the source-code.

Select this script as the 'Pre-build script path' process parameter. It is in the 'Advanced' sub-section of the 'Build' section, which is collapsed by default. The actual path depends on how you installed the scripts into your version-control.

The parameters for the script are provided as the 'Pre-build script arguments' process parameter. See the description of the Update-Version function to see what parameters are available. The SourcesDirectory and BuildNumber parameters for the function are provided by this script and taken from the build-environment; they cannot be provided to this script. The other parameters are passed to the Update-Version function.

The image below shows an example of an explicitly provided version and patterns for each attribute. Note that the patterns for the file- and product-version are the same as the default values.

PreBuild-script in build-definition

Parameters

AssemblyVersionFilePattern

Specifies the pattern to use for finding source-files containing the version-attributes. Default is "AssemblyInfo.*".

Version

Specifies the version to use. May contain the following (uppercase!) tokens :'YYYY', 'YY', 'M', 'MM', 'D'. 'DD', 'J', 'B' and 'BB'.

AssemblyVersionPattern

Specifies the version, or pattern, for the assembly-version. Depending on the provided version (either through the Version or BuildNumber parameters) the default is '#.#.#.#' (.NET) or '#.#.#.0' (SemVer). May also contain symbols as described for the Version parameter.

FileVersionPattern

Specifies the version, or pattern, for the assembly-file-version. Depending on the provided version (either through the Version or BuildNumber parameters) the default is '#.#.#.#' (.NET) or '#.#.#.0' (SemVer). May also contain symbols as described for the Version parameter.

ProductVersionPattern

Specifies the version, or pattern, for the assembly-informational-version. Depending on the provided version (either through the Version or BuildNumber parameters) the default is '#.#.#.#' (.NET) or '#.#.###' (SemVer). May also contain symbols as described for the Version parameter.

PackageVersionPattern

Specifies the version, or pattern, for the nuget-packages. Depending on the provided version (either through the Version or BuildNumber parameters) the default is '#.#.#.#' (.NET) or '#.#.##' (SemVer).

Disabled

Specifies that no changes should be made.

Verbose

Specifies that more detailed logging should be provided.