Monday, March 26, 2012

Many projects with only one web.config?

Hi all,

I have a solution with 8-10 projects (all different sites). Currently they all have their own web.configs. Seeing as they are all related (some are front ends, some are backend CMS's for the front ends) it would be handy to be able to have just one web.config for them all.

Any body know how I could accomplish this?

Thanks!It would be handy, but it would be inefficient and represents poor project architecture.

Nevertheless, to answer your question:

Allow each web.config to remain there, but in the appSettings tag, do this:

<appSettings file="somefolder/abc.config"/>

It will then read the appSettings settings from the config file that you have specified.
Thanks for that mendhak, i'll give it a go.

Just out of interest why do you think that would be bad project architecture?

Surely many projects using the same config would be good architecture? less duplication, easier deployment etc.

But I would certainly be interested in hearing your comments so i can make an informed decision.

Thanks again.
Having multiple projects with a single web.config file is equivalent to having all your code within a single project, in the sense:

If you have created a class library, they should be atomic units that can be used by other applications at a future point in time even though that may never be the case. Atomic, also implying that they can (in certain cases) exist in different locations on the server or possibly (such as in the case of web services) on different machines.

0 comments:

Post a Comment