Home > Miscellaneous > web.config transformation for project deployment

web.config transformation for project deployment

Consider we have different hosting environment like UAT, live, Dev, so we need to differentiate setting according to hosting environment. 

We can you web.config transformtion for the same.

A transform file is an XML file that specifies how the Web.config file should be changed when it is deployed. 

Creating and Coding a Transform File:

  1. Create the build configuration first by using Configuration Manager.
  2. In Solution Explorer, expand the application Web.config file.

If any transform files have already been created, the Web.config file is displayed in Solution Explorer with a symbol indicating that it can be expanded, and the transform files are shown when you expand the Web.config file.

  1. If no transform file exists for the build configuration that you want to specify settings for, in Solution Explorer, right-click the Web.config file and then click Add Config Transforms.
  2. Open the transform file for the build configuration that you want to work with.
  3. Edit the transform file to specify the changes that should be made to the deployed Web.config file when you deploy by using that build configuration.

Example: If we want to transform 

 

References:

  1. https://msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx
  2. https://msdn.microsoft.com/en-us/library/dd465326(v=vs.100).aspx

 

 

 


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">