Is it possible to share the web.config across multiple projects in a solution?(ASP.NET)

后端 未结 3 872
执笔经年
执笔经年 2020-12-02 02:01

I have a solution composed of a web application and multiple projects, is it possible to share the configuration in the web application across all the solution?

Than

3条回答
  •  臣服心动
    2020-12-02 02:38

    I looks like it is possible, you can try following:

    You can copy your web.config file to the root folder of your solution. Then create solution folder (which does not belong to any of your projects) and add your file there (via Add Existing Item popup menu item). Delete web configs from your web sites. After that you can select Add Existing Item from popup menu on your both web projects, select your web.config file from the solution root and click Add As Link. After that you will have links to your web config files instead of real ones in your solution.

    alt text

    On the other hand I'm not sure if sharing of the web.config files among different projects is a good idea, because usually web.config has some specific condifuration for each separate application.

提交回复
热议问题