How to modify the UpgradeTemplate.xaml to enable releasing from a build

Leo Vildosola

Release Management provides the option to trigger a release from a build. But to use this feature, some additional logic has to be added to the default build process template. You can refer to my previous post on doing this with the default build process templates for TFS 2013. This article details how to make the necessary modifications specifically for the UpgradeTemplate.xaml.

If you are currently using the default UpgradeTemplate.xaml build process template

If you are using the default UpgradeTemplate.xaml build process template all you need to do is use the corresponding ReleaseUpgradeTemplate.xaml build process template.

If you are currently using a customized UpgradeTemplate.xaml build process template

If you have customized the default UpgradeTemplate.xaml build process template, then you can use the snippets file (ReleaseUpgradeTemplate.Snippets.xaml) to help you integrate the release-specific customizations into your own custom UpgradeTemplate.xaml build process template.

Modifying your own custom UpgradeTemplate.xaml build process template

The snippets file (ReleaseUpgradeTemplate.Snippets.xaml) only contains sections with start / end markers to indicate which parts to copy.

The following is a sample section with start / end tags that is surrounded by some context.

<x:Members>
  <!– RM : START –>
    <x:Property Name=”ConfigurationsToRelease” Type=”InArgument(s:String[])” />
    <x:Property Name=”ReleaseBuild” Type=”InArgument(x:Boolean)” />
    <x:Property Name=”ReleaseTargetStage” Type=”InArgument(x:String)” />
  <!– RM : END –>
</x:Members>

Where <x:Members> … </x:Members> indicate the context and everything between the start / end tags indicates what to copy as is (yellow).

The only exception is the Activity element, where you will need to copy the attributes in the snippets file and add them to your custom build process template, without removing any existing attributes.

<Activity this:Process.ReleaseBuild=”False” xmlns:mtc=”clr-namespace:Microsoft.TeamFoundation.Client;assembly=Microsoft.TeamFoundation.Client” xmlns:mw=”clr-namespace:Microsoft.Win32;assembly=mscorlib” xmlns:sco=”clr-namespace:System.Collections.ObjectModel;assembly=mscorlib”>

Using the ReleaseUpgradeTemplate.xaml build process template

Consider the following when using the ReleaseUpgradeTemplate.xaml build process template.

  1. When using the functionality to automatically trigger Releases from a Build, you will need to install a Release Management client on your TFS Build Server. After installation, restart the TFS Build Services.
  2. While editing the Build Definition, Set the Release Build parameter to TRUE, to indicate that you want the build to be released.
  3. Specify the Target Stage for the Release in the Release Target Stage parameter. Leave blank to allow the Release to go through all the Stages defined in the Release Path. The check is case sensitive so make sure to match the name of the Target Stage verbatim.
  4. Ensure the Release Template is configured to match the Build Definition and the property Can Trigger a Release from a Build? is set.
  5. Specify which Configurations to Release (e.g. Debug, Release, etc.)

ReleaseUpgradeTemplate.zip

0 comments

Discussion is closed.

Feedback usabilla icon