Last post Mar 27, 2019 07:15 AM by Wei Zhang
Mar 26, 2019 05:19 AM|robby32|LINK
I have a web project and a main / default web.config , but I have different environment, a Debug, QA, Dev, Release.
Now if I want to run on the Dev environment I need to manually copy the webDev.config as the web.config for the app, likewise if testing on QA.
Is there an automation process for this ?
I have looked at web transforms , but there are more than just connection string changes .
Any suggestions as to how I can do this ?
Mar 26, 2019 07:58 AM|AddWeb Solution|LINK
Try with this, may be this will help you.
The <appSettings> tag in web.config supports a file attribute that will load an external config with it's own set of key/values. These will override any settings you have in your web.config or add to them. We take advantage of this by modifying our web.config
at install time with a file attribute that matches the environment the site is being installed to. We do this with a switch on our installer.
Changes to the .config specified by the attribute won't trigger a restart of the asp.net worker process
Mar 26, 2019 10:12 AM|robby32|LINK
Is there an example to illustrate this .. how and where required changes are needed.
I sort of get what you mean. But where can I start to make changes.
See I have in my app a web.config as the default and below that are 4 mor config files, webqa.config, webdev.config, webrelease.config, webtest.config.
Now when I run the app , I want to be able to tell VS that if its run under a Dev environment then use the webdev.config as the web.config file.
Also I use a CI tool and want to be able to tell when the CI pipeline is running in a particular mode then take that config file.
Mar 27, 2019 07:15 AM|Wei Zhang|LINK
Hi , robby32
According to your description, visual studio transforms only web.config files by default, If you need custom config file with transformation for DEV, UAT, PROD, etc environments, then you could try below:
1.Use custom extensions for Visual Studio like SlowCheetah - XML Transforms for Config transformation preview functionality. You should download this package.
This package allows you to automatically transform your app.config (or any file) when you press F5 in Visual Studio. You can have different transformations based on the build configuration. This will enable you to easily have different app settings, connection
strings, etc for Debug versus Release. If you want to transform other files you can do that too. Here is the link, I hope it could help you.
2.You could install SlowCheetah to your webapplcation
Here is the link, I hope it could help you.