My web.config file has a large amount of connectstrings in it that I tend to have to switch back and forth between frequently. This currently involves commenting out the current one, and uncommenting the required config.
I’m a little bit sick of having to do this all the time, and want to make a solution to automatically do it, e.g. simply select the relevant connectstring from a dropdown list and run the project. I was thinking this would be pretty straightforward to write an app to do this using vb.net and regex.
The problem I have is that once I edit the web.config, I get a message coming up in Visual Studio; “This file has been modified outside of the source editor. Do you want to reload it?” Is there any way to reload the file from outside of Visual Studio?
You don’t need to create an application to do that, you can use web.config transformation and just choose the configuration for your web.config from a listbox and Visual Studio will do the job for you
see these references:
http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx
http://weblogs.asp.net/srkirkland/archive/2009/10/13/common-web-config-transformations-with-visual-studio-2010.aspx
http://weblogs.asp.net/gunnarpeipman/archive/2009/06/16/visual-studio-2010-web-config-transforms.aspx