简体   繁体   中英

Centralised web.config in Asp.Net

I have almost 20 projects in my web solution which include asp.net web application and windows service projects. These all project contains web.config and app.config respectively.

Now I want to remove this all files and want to place a single web.config file in the solution which will be accessed by all the projects.

Can anyone suggest me of doing this ? If yes then how the projects will call the web.config from the solution root ?

try to use Shortcut/link instead of physical files. to achieve this:

  1. keep only one app.config file (the one you edit most frequently probably, does not matter from which project)

  2. at each of the rest projects, remove existing app.config file, then right click your project (or the folder you want to place this app.config), click Add, then select "Existing Item...", at the popup, select the physical one you kept in step 1 and then click the arrow next to the "Add" button, select "Add as Link".

now then all the projects (except the one you selected) will reference the one you kept as a link (shortcut).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM