Category Archives: rmtfsint

MS Release Management- Web.Config tokenization for website project

21 Dec 14
No Comments


Web.config tokenization/parameterization is one of the major part of releasing web applications across different environments. But when it’s coming to website type project in Visual Studio, it’s a real head ache. I have came across such situation and spend lot of time to find a practical solution to solve this issue. Here I am explaining a tricky method to tokenize web.config, which is partially manual but practically implemented for website type project through MSBuild and MS Release management 2013.

Why Tokenization for Website Projects?

One of the recommended way of web.config parameterization is through Parameters.xml and webdeploy. But this approach is only applicable for web application project in Visual Studio, as this is happening through project file(csproj/vbproj). As you may know, Website project don’t have a project file. Because of the same reason, Config Transforms also will not work for website projects.
Here I am explaining a customized method of web.config tokenization applicable for website projects.


Tokens are used by release management to know part of text that needs replacement with specific values. For release management to recognize a token, it needs to be prefixed by two underscores (__) and post-fix by two underscores (__), for example __WelcomeText__. Standard transformation will be applied while building on the Build server in order to have tokenized configuration files available in the drop location ready for release management to use during deployment.


We need to add a new config file to the project, I named it as web.Token.config. This file is an exact copy of our web.config file. Only difference between web.config and web.Token.config is, web.Token.config will have tokens instead of original values. See the below screens for more clarity.
Picture 1
Picture 2
Picture 1 shows the original configuration file used for the development purpose and picture 2 is our token file with tokens instead of real values. These tokens will be replaced through RM tool, will explain in the upcoming sections.


TokenizeAndDeploy.bat is batch file and this file is playing a key role in release process. There are two steps included in this file.
1. Replace web.config with web.Token.config
2. Copy build from the source location to the destination folder
Picture 3
You can see two lines in this batch file. First line copy and replaces the web.config file with web.Token.config. Second line will copy the published website from the build drop location to the destination folder, where destination folder is mentioned as an argument to the batch file. That is, %1% is a batch file argument and the value will be passed in the release template.

Create new component in Release Management Client

We need to create a new component in release management client and this component will make use of our batch file to release our published site. We have to specify the source location of the published site and which is under build drop location, see the screen below. Make sure that TokenizeAndDeploy.bat also kept under the website root folder, otherwise we need to mention the inner folder path in the next tab (Deployment).
Picture 4
Picture 5
In the Deployment tab:
Tool: No tool
Command: TokenizeAndDeploy.bat _InstallationPath__
(Value will be passed in the release template)
Timeout: Depends on the amount of files to be copied and the network speed, default will be 5 minutes
Picture 6
Now our web.config contains all tokens and we need to replace the tokens with the values with respect to the target environment (ie, UAT, Production etc). Configuration Variables playing this role. We need to add variables for each tokens in our web.Token.config. Variable name should be exactly same as that of the token, ie one of our token is __DocumentPath__ so we have created variable DocumentPath. Select After Installation as the variable Replacement mode as shown in Picture 6.
Save & Close this component and we need to add this component in the release template.

Add Component to the Release template

Instead of XCopy deployer, we need to make use of the newly created component in our release template. Add Tokenize & Copy component to the tool box and drag and drop it to the server box of our deployment sequence.
Picture 7
Picture 8
Double click on the Tokenize & Copy component in Picture7 and we can see the input boxes to provide values for each configuration variables in Picture 8. Same component we can use with different Stages (UAT, Production, Client1 Client2 etc) in the release template. So from the next release onwards, our web.config will be properly updated with the Stage specific entries.
My previous articles may help you in case you have any confusions using release management client.


Here I have tried to explain one of my implementations of web.config tokenization which is applicable to website type project in Visual Studio. It’s hard to convert website project to web application, if the application is complex and big. This could help people those who are struggling to find a possible way to release website projects across different environments using TFS and MS Release Management for Visual Studio 2013.
Thank you.

MS Release Management – Database deployment using DACPAC

11 Sep 14
No Comments


This article aims at providing guide lines to automate Databases release to SQL Server using MS Release Management tool and Data-tier applications in Visual Studio. If you are not familiar with Release Management, you can make use of my article to configure the RM environment.


Database integration is a main headache in continuous integration of Software Applications. Integrating Databases manually is very painful and required lot of effort to keep track of the schema changes, updating scripts etc. Release Management for Visual Studio 2013 is a very useful tool to achieve continuous integration of applications. 

Data-tier Applications

DAC is an entity, which defines all SQL Server DB object like tables, views etc. Database developer can use SQL Server Data Tools database project to design a database in Visual Studio. A successful build of this project will generate a DACPAC file with .dacpac extension. Go through the below article url for a better understanding on DAC.


Few installations need to be done/verified on the target DB server before going forward with DACPAC deployment through RM Client.
  • MS Deployment agent should be installed, configured and its identity should have access to SQL Server DB instance. The user must be a member of the dbmanager role or assigned CREATE DATABASE permissions to create a database, including creating a database by deploying a DAC package. The user must be a member of the dbmanager role.
  • .Net 4.0 should be installed.
  • Microsoft SQL Server 2012 Transact-SQL Script Dom should have been installed. You can verify the installation  by looking for C:WindowsMicrosoft.NETassemblyGAC_MSILMicrosoft.SqlServer.TransactSql.ScriptDomv4.0_11.0.0.0__89845dcd8080cc91Microsoft.SqlServer.TransactSql.ScriptDom.dll

DACPAC Deployment

Main activities to deploy a DACPAC file to SQL Server database instance can be categorised in to two.

  1. Create SQL Server Data Tools database project
  2. Create Component & Release Template in RM Client
  3. Trigger the Release

Create SQL Server Data Tools database project

Here you are going to create a DB project for an SQL Server DB which is already available in your development environment. Connect to the development DB instance through SQL Server Object Explorer in Visual Studio 2013. Right click on the DB and choose “Create New Project” as shown below.

Provide a name for the project, location to store and click Start.
Import database progress will be shown in the next screen as shown below. Once done, click finish
Your DB project will be created at this time and you can check it under solution explorer as shown below.
DB snap shot should be created and this action will provide a file with .dacpac extension. Right click on the project and create DB snap shot as shown below.
“Snapshots” folder will be created under the solution and i renamed it as DemoDBProject.dacpac file will be created under this folder.
Here i am explaining build externally method of RM component to pick the input package.  You need to move this DemoDBProject.dacpac into a shared folder, which should be accessible by the MS Deployment Agent(Provide read permission for the account running MS Deployment Agent).

2. Create Component & Release Template in RM Client

You need to create a new component and release template to trigger a new release. Basic RM configurations should be done prior to this. 

 2.1. Create Component

Open RM client and go to Components under Configure Apps tab. Click on new button. Provide component name and select Build Externally option. Input folder of the dacpac file should be provided here. See the below screen for the clarity.
Select Deployment tab, choose DACPAC Database Deployer(red marked below) and click  save & Close.

2.1 Create Release Template

Create a new Release template, provide name and select release path as shown below. Since our build source is a shared location, no need to select TFS build definition here.
We need to use the component created in 2.1 in our release template. To add the component here, right click on the components in the left panel as shown below and click on Add.
From the components list, choose the newly created component for DACPAC deployment and click on Link button which is shown below.
As you may know, first we need to drop destination server in to the Release Template. You can drag and drop it from the left panel. 
Now the component should be dropped in the server box. Double click on the component box and provide the parameters, which is required.

3. Trigger the Release

Create a new Release, provide name and select newly created Release Template here. Click on Start button and trigger the release.
You can see the status of the release as shown in the below. If the release is successful, the status will be Done as shown here.
Connect to the target SQL Server DB instance and open the DB, both you have provided as parameters for the component while creating the release template. Check the DB schema and verify the release status.


DACPAC is a very useful utility for the DB deployment. Which avoids the headache to synchronise the  DB schema against new enhancements and fixes of a software system in different environments. MS Release Management tool help us to make use of the DACPAC  in a very effitient way to relase DB and this can be done along with application release as well.
Thank you.

Untrusted domain connectivity in Release Management for Visual Studio 2013

30 Jul 14
No Comments


The scenario is to deploy your web application to a machine, where there is no domain trust between your RM (Release Management) environment and that target machine.
This post explains the steps to configure RM to work across untrusted domains using ghost/shadow accounts. Ghost accounts are local user accounts with same user name and password in two machines. Here you will install RM in one machine and Deployment Agent in another with out any domain trust.

Step 1(Create user in target server):

Create a user in the target server where you want to deploy the application. Password should be created with never expire policy.

Assign the user to the member of Administrators group.

Step 2(Microsoft deployment agent 2013 installation):

Install Microsoft deployment agent 2013, there are only few simple steps to install this as showing below.

If you click on the Launch button, a screen will be shown with a text box to provide RM server url and credentials to connect with RM server. We will do it later.

Step 3(Create user in the RM server machine)

Create a user with same user name and password(step 1) in the RM server machine, which we call it as ghost/shadow account.
Create the RM server shadow account as a new user in RM client and grant both “Service User” and “Release Manager” permissions. In the below screen, Release Manager should be “Yes”.

Add deployment agent’s shadow account to RM client and grant “Service User” and “Release Manager” permissions. This  “Release Manager”permission can be reverted once this connection established successfully.
Ex: If deployment agent machine name is Machine2, two user should be created in RM client, ie “user name” with as describe earlier in this step and Machin2/

Step 4 (Configure Microsoft Deployment Agent)

Now login to deployment agent machine using Ghost account  and open Microsoft Deployment Agent 2013. A configuration window will be opened, there you have to provide RM server url and account to connect. You should provide ghost account and click on Apply Settings. If your configuration is successful, following window will be shown.


NB: Incase of any error in the above step, verify earlier steps and make sure that you have followed each instruction correctly.

Step 5

Open Servers tab under Configure Paths in RM client. Registered servers will be listed there as showing in the below screen. Click on Scan For New.
A pop up will be displayed with unregistered server details. Your newly configured server should display in that list and you can register that server by double clicking on it or click register button, as showing in the below screen.


RM gives the flexibility to automate and manage your release process. I hope this article will help you to configure and design your release with out the barrier of domain trust.
If you are new to RM, you can make use of my post to understand and configure RM.
Enjoy your releases with Release Management for Visual Studio 2013. 
Thank you for reading.

Release Management for Visual Studio 2013

19 May 14
We can automate release process of different types of applications like web applications, databases, reporting projects etc using release management. Here I am trying to give an overview of basic configurations and deployment set up of a web application.


With release management in Visual Studio we can configure, approve and deploy our applications for any environment. Create automated deployment orchestrations for each environment no matter how complex the configuration. Delivering our software more frequently and easily to an environment allows your testers to get to work validating your system and keeps your stakeholders involved in giving feedback.

There are three components in release management:

  • Release Management Server
  • Release Management Client
  • Deployment Agent 


Download “Release management for visual studio 2013 with update 2 RC”. It includes RM Server, RM Client and deployment agent. Install RM Server and RM Client in the build machine and deployment agents in the target servers, where we are going to deploy the application.

RM Client

RM client is a WPF application and which is used to configure different settings in RM server and RM Service. Important roles of RM client are:

  • Release management configuration
  • Building release pipeline
  • Define release template
  • Trigger Kick off release

In RM client we have to configure TFS Connection, servers, stage types, environment etc. Below sections describes the required step to be done prior to the release and finally triggering automated application release.

TFS Connection
We should create TFS connections to connect with different team project collections. We can connect to any version of TFS. Below screen shows the TFS connection page.

Click on the new button to create a new connection.

Provide TFS url, project collection name and we should provide a user account to set the identity of the connection. This account is used in release management to talk to the team foundation server. The user identity can be set in the “connect as” section showing in the above screen.

NB: Before using the service user for RM/TFS integration, we should add the user/group into TFS by running the below command in visual studio command prompt.

Tfssecurity /g+ “ Team Foundation Service Accounts” n:RMTFSINT ALLOW /server:http://localhost:8080/tfs

Where RMTFSINT: Account name, Team Foundation Service Accounts: group of service accounts belongs to and http://localhost:8080/tfs: tfs url.

After providing the account name and password, click on verify link as showing above.

After save and close TFS account will be created and listed as in the below screen.

Stage Types & Technology Types

In stage types, we can define different stages or release paths of deployment. Those can be staging production etc. Click on stage types as shown in the below screen.

 Click on add button in the stage type page and different types.

Technology Types

Technology types doesn’t get used anywhere in release but this is a Meta data and it’s used to categorize and organize things.

Servers & Environments


From the configure paths Home page, go to servers page as showing below.  Before adding servers here, we should deploy deployment agent in the server. We can add server manually or scan servers where we deployed the deployment agent already using new button on top right corner showing below.

Scan for new will give following pop up if deployment agent installed in the server which is accessible.


Here we should create different environments like dev, prod etc.  We can select servers, supported technologies and stage type security.

Release Paths

In release paths, we can create different stages of the deployment and link corresponding environment and define required work flows. We are able to define security of the release path as well.


Components contains Source, Deployment, configuration variables and release template using components.


Here we can select different build options and specify the location of the build drop location.


We can select the tool to deploy the application. In the below screen XCopy deployer is selected and which is used to simply copy the files to the destination.  Installation path is argument their which we need to provide when we add it in the release template.

Configuration variables

Configuration variables are important when we handle with complex scenarios like doing some actions before installation, after installation etc.


Release templates using component

Release template using component will lists the release templates where this component is used.

Release Templates

Release template is the blue print of the release. Here we should select the release path and build definition from TFS. 

We can perform different actions during the deployment such as configuring app pool, create web application etc. using the tool box in the left pane. Below screen shows an example of release template screen. Similar work flow we can create for other stage types (QA, Prod).


Once we done with creating the release template, the last and final thing is to create the release. Release will trigger the release process which we defined in earlier steps. To create a release, go to release and click New button. Below screen shows the new release template create screen.

  • We should select release template for the release
  • Target stage defines, up to what stage this release can be go. We can restrict release to production or QA for this release, if needed.
  • Build should be selected here and it is from the drop folder.  Drop folder we already defined in the component and the component is added to the release template.

We can click start, if we are done with the release or it can be saved as Draft. The release kik off will be happened if we click start here. See the below screen with one release is in progress.