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 :-
- In the Release Management Client, go to the tabs – Configure Apps > Component and select the required component:
- 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.
- 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.
- Save and close it.
- 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__
- 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–