Config file data changes during runtime in RM

In the real business scenario, it is always the requirement that every environment (QA, Stag, Prod etc) have its specific data mentioned in the different config files. As an example, the most common requirement is that every environment have its own database connection information in the config file.

Now the question is, how to get it changed/updated when release will go to the particular stage?

Here are the steps that can help us implementing it :-

  1. In the Release Management Client, go to the tabs – Configure Apps > Component and select the required component: image
  2. Double click the selected component. It will open it. Select the tab “Configuration Variables”. Add the variable by clicking the Add button. Select the required Variable replacement mode from the dropdown list. Finally select the File Extension filter which will be considered for replacing the added variable. Here in this example, I have taken web.config and so File Extension filter will be *.config. image
  3. In the release template, add the above changed component and set the appropriate value for the variable. Copy the component into all the configured environments and change the value of the variable accordingly. image
  4. Save and close it.
  5. Finally go to the visual studio and edit web.config and add variable in it with two underbars both at start and at the end. Example, in our case, we added username=__USERNAME__image
  6. Trigger the release and it will replace the value of __USERNAME__ with the one defined in the components in RM for the respective environment.

–End of Article–


Trigger Agent Based Release in RM from vNext Build in TFS 2015

In Continuous integration (CI), one has the requirement to trigger release of the build artifacts to the intended environment. In TFS 2015 and RM 2015, it can be achieved using the below steps:

  1. Release in the release management needs to be configured. I am not going to cover how to configure it here in this article but for the triggering perspective, below setting should be done in it: image  
  2. On the build machine, install and configure the Release Management 2015 client. It should be configured successfully.image
  3. In the Release Management Client, add user under whose context the vNext build agent is running. For doing this activity, Go to Administration > Manage Users and click New to add the user.
  4. Now in the vNext build definition, add a new Task of type “Command Line”: image
  5. Once this task is added, Name it and enter the below data in it:      
    Tool ReleaseManagementBuild.exe
    Arguments –rt ‘MyReleaseTemplateName’ –pl ‘MyPackageLocation’ –ts ‘ReleaseTargetStage’ 
    Example –  
    Tool C:\Program Files (x86)\Microsoft Visual Studio 14.0\Release Management\Client\bin\ReleaseManagementBuild.exe
    Arguments -rt ReleaseTemplateTest -pl \\DropServer\TFS_Drop\$(Build.DefinitionName)\$(Build.BuildNumber) -ts QA  


  6. Enable Continuous integration (CI) from the Triggers tab of the build definition. image

Now once the above steps are done, agent based release can be triggered from the vNext based build definition in TFS 2015 and you will get below information from the build console: image

——End of the Article——