Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Web.Debug.config and Web.Release.Config files for?

I just upgraded to Visual Studio 2010 and MVC 2.0 and I noticed the Web.config has two additional files attached to it? Are these files used to specify debug and release specific settings, so you don't clutter up the main Web.config?

Does it even make sense to place a connection string in the root Web.config file if I have a local and remote one in the debug and release Web.configs respectively?

Thanks!

like image 463
chobo Avatar asked May 07 '10 19:05

chobo


People also ask

What is Web debug config?

This is the transform that is applied when you publish your application to the development staging environment. This would make changes to the web. config which are required for the target environment.

What is the web config file used for?

A web. config file is a Windows file that lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web. config file in your root directory, it will affect your entire site (www.coolexample.com).

What is the use of Web config and machine config files?

The web. config files specify configuration settings for a particular web application, and are located in the application's root directory; the machine. config file specifies configuration settings for all of the websites on the web server, and is located in $WINDOWSDIR$\Microsoft.Net\Framework\Version\Config.

What web config file contains?

web. config file is an XML-based configuration file used in ASP. NET-based applications to manage various settings that are concerned with the configuration of our website. In this way, we can separate our application logic from configuration logic.


1 Answers

It's the new Web.config transformation feature of Visual Studio 2010. More information here.


Edit:

Are these files used to specify debug and release specific settings, so you don't clutter up the main web.config?

It isn't limited to three files, you could (in theory) have as many files as you have environments. The "top level" Web.config provides a template of your web config. The files under it provide replacement values specific to that environment (like if you have different connection strings for local/stage/test/whatever).

Does it even make sense to place a connection string in the root web.config file if I have have a local and remote one in the debug and release web.configs respectively.

It would only make sense if it wasn't going to change between environments. Sounds like in your case it does so, in your case no, it would not make sense to leave it in the Web.config.

like image 50
Roman Avatar answered Sep 21 '22 00:09

Roman