Creating Multiple Web.Config files

Where to use?

If we deal with multiple development environments, then it became very tricky to track the environment specific settings.

To achieve this VS allows us to have more than one web.Config file in single project

Creating multiple Web.Config files

Let we step by step process for creating it.

Step : 1

In Visual Studio, navigate to the Solution Configuration drop down list and choose “Configuration Manager”

MultipleConfigurationMode 1

Step : 2

The wizard look like below

MultipleConfigurationMode 2

Then choose the solution configuration drop down and select “New”.

MultipleConfigurationMode 3

 

Step : 3

In the wizard enter the name and click “OK”. If your want to copy setting from any other transform then choose it(other settings like Debug,release)

MultipleConfigurationMode 4

Step : 4

Finally, right-click on Web.Config file and choose “Add Config Transform” to add newly created configuration file under web.config like below

MultipleConfigurationMode 6

Then click web.config file and see the newly added file(ie., Web.QAMode.config)

 

MultipleConfigurationMode 7

 

Step : 5

Select required mode and run the application.

MultipleConfigurationMode 5