Is there a way to split app/web.config into 2 files?

一个人想着一个人 提交于 2019-12-12 11:37:03

问题


I currently use app/web.config to store Connection Strings for my database, which means on upgrade we do not touch the config files to preserve those strings. However we now want to move to MVC5 and doing so requires all the library definitions to be updated within the app/web.config (we have both an App and a website with similar configuration).

So is it possible to split these files into two files so that I can update the library definitions whilst keeping intact my existing infrastructure to read out the connection strings from the .config files? Or is there another method to deal with this?


回答1:


Yes; you simply create a second file rather than including things inline, for example:

<configuration>
    <connectionStrings configSource="connections.config"/>
</configuration>

The connections.config file would start with <connectionStrings>...</connectionStrings>.



来源:https://stackoverflow.com/questions/22686750/is-there-a-way-to-split-app-web-config-into-2-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!