User guide

27
2.13.2 Visual Studio 2010, Visual Studio 2012 and Visual Studio 2013
When using Visual Studio 2010, Visual Studio 2012, or Visual Studio 2013, release management provides its own
template (select the proper version of the Build template corresponding to your TFS Version). This build template
contains the logic needed to trigger a Release from a build.
This template also contains the logic to tokenize your configuration files. This logic assumes that in your solution,
you have two versions of your configuration files. One version is your normal configuration file used during local
development, and the other is a corresponding file that has the same content, except that instead of having local
values for your variables, tokens have been put there. The build activity will swap those two files before doing the
build, so that we end up with the tokenized version of the configuration files in the drop location.
Here is an example of how to achieve this: For example, if your solution contains a file called web.config, then you
will need to copy that file (and keep them in sync), and name it web.config.token. Your web.config file will stay the
way it is now (and that is what is going to be used when you run the app locally). The web.config.token will contain
tokens instead of values.
So, as an example, let’s say you have in your web.config this line:
<add key="SMTPHostServer" value="mysmtp.myserver.domain"/>
Then, you would have this line in your web.config.token:
<add key="SMTPHostServer" value="__SMTPHostServer__"/>
2.14 Include Release Management Custom Build Logic into a Build Template
To be able to provide some of its functionality, release management provides a TFS Build Template with additional
logic. If you currently use the DefaultTemplate provided by TFS, you can simply replace it with the
ReleaseDefaultTemplate and you will be up and running. However, if you have modified the DefaultTemplate to
add your own logic, you will need to merge the build logic to yours.
Note that this is only needed if you want to take advantage of one of the following features:
Automatically trigger releases from a build
Use the file swapping technique to get tokenized file in the drop location
Here is a step by step procedure to get the logic into your Build Template.
2.14.1 Add arguments to custom Build Template
Open ReleaseDefaultTemplate.xaml (TFS 2010) - or ReleaseDefaultTemplate.11.1.xaml (TFS 2012 & TFS 2013).
Those files can be found on a computer where release management components have been installed at this default
location: C:\Program Files (x86)\ Microsoft Visual Studio 12.0\ReleaseManagement\bin. Find the last 3 arguments
and add them to your customized Build Template:
*** If you are using the DefaultTemplate.xaml from TFS 2012, you need to add a "DropBuild" argument. In TFS
2010, the "DropBuild" argument already exists in the arguments list.