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

前端 未结 4 1959
时光取名叫无心
时光取名叫无心 2020-11-28 22:55

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 spe

4条回答
  •  醉酒成梦
    2020-11-28 23:43

    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.

提交回复
热议问题