How to change web.config when running Deploy?

1

I have an approval and a production environment in the cloud, but I deploy Deploy in File System .

I have to insert some parameters and change the connectionString for each of these environments.

Parameter examples:

  • Information to know when the approval environment is and not to send emails to clients, only to test inboxes;
  • Inform the directory where the files should be saved.

Is there any way to change web.config , adding or changing parameters depending on the Deploy option I choose?

    
asked by anonymous 06.01.2016 / 22:03

1 answer

3

You can use Web.Release.config where changes can be made made at the time of publication.

In the link above it has an example of how it works, worth a deal, it's pretty cool.

A practical example of it that I use that is to upload a server just in production is like this:

  <appSettings>
    <add key="RodaServ" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" value="true"/>

Where it changes the key RodaServ to true when it is published.

    
06.01.2016 / 22:11