Learn to use Visual Studio, Visual Studio Online, Application Insights and Team Foundation Server to decrease rework, increase transparency into your application and increase the rate at which you can ship high quality software throughout the application lifecycle
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. This article details how to make the necessary modifications.
If you are using the TFS 2013 default build process template all you need to do is use the corresponding release management build process template.
If you have customized the TFS 2013 default build process template (GitTemplate.12.xaml or TfvcTemplate.12.xaml), then you can use the snippets file (ReleaseTemplate.12.Snippets.xaml) to help you integrate the release-specific customizations into your own custom build process template.
The snippets file 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">
Consider the following when using the Release Management build process template.
For more clarity on points (2) and (3) above please see the sample image below.
How do you specify the component in the buildtemplate if the release template includes multipel components?
@Stefan, when dealing with multiple components, you can add them to the Release Template in the Toolbox. Right click on the Components node and select Add. You can then drag each of them from the Toolbox to the Deployment Sequence. Each instance will be uniquely identified. Each component can be used in each Stage, as each stage contains a different deployment sequence.
Our system is built with multiple subsystem with individual builds definitions in tfs. I have configured one release template with several components for each subsystem to be able to release the complete system to one environment. That means the modified build template that starts the release pipeline does not includes all the components i need for the release. In my case it would be OK to have a way to get the latest build for the other components in my release template. Any suggestions to solve this issue?
@Stefan, the RTM version of RM is not capable of doing what you ask. However, this is something that our team has been considering.
The scenario would be as you describe. Your components are built externally, whenever you trigger a build that is associated to the corresponding release template, the respective latest bits for those components externally built will be pulled in.
@Leo: These templates seem to miss the functionality for swapping the .token files?
@Jakob, let me take a look. Are you coming from a previous version? I'll double check if we had removed that logic.
I also do not see a sequence for initializing tokens in GitTemplate.12.xaml. Is there a version that contains token functionality?
@Nick, thank you for your feedback. We are currently looking into this. We plan to update all release build process templates to include this logic. Keep track to this post, as I will update it as soon as we have something to share.
@Jakob / @Nick, I have updated the build process templates to include support for ".token" files. Download the zip file again and replace your existing templates with this one. Let me know if this satisfies your needs. Thanks again for bringing it to our attention.
Is this possible with TFS 2012 build? I cannot merge the snippets succcessfully.
The property (ConfigurationsToBuild) is either invalid or not defined
I just noticed in the ReleaseManagement/bin folder there is an 11.1 template for TFS 2012.
I find that it always deploys the PREVIOUS build. To get it to deploy a specific build, I have to run the build twice!
I notice that in the build log, copy to drop folder is the final step, after the release management tool is invoked. This seems wrong - surely it needs the build located in the drop folder before it can invoke a release?
My component is sourced via 'Builds Independently' and the path to package is [Build Drop Location]\\.
@JasonC, the build process template already has logic within the release logic to copy the files to the drop location. Chances are that the snippet you observed is the one used in the case where we are not releasing from a build.
It looks like the problem you are experiencing is more related to the fact that in order to release from a build your components need to be configured either as "Builds with application" or "Builds externally".
Please refer to the following article for all the details on triggering a release from a build, especially the section under the question "Can I deploy components of my application to different machines?"
We use TFS 2010 at the moment at my work. Are the snippets compatible with TFS 2010 and with build template that references v10.0 assemblies?
I have downloaded the templates from the link above and they are the same as the out-of-box (TFS2013 Update4)
And Im having the "Release build failed (type Exception)"
Am I missing something?