all groups > visual studio .net general > november 2006 >
You're in the

visual studio .net general

group:

My.Settings versus AppSettingsReader in solutions with multiple project config files


My.Settings versus AppSettingsReader in solutions with multiple project config files bri NO[at]SPAM northfieldbham.freeserve.co.uk
11/24/2006 2:52:43 AM
visual studio .net general: All,

I've trawled the net for an answer to this particular query and have so
far come up blank.

The situation is that I have a business object component (call it
Business.dll) which I want to use as part of a number of applications,
developed using VS2005. For the moment, I want to deploy it as part of
client applications which will also be developed with VS2005. However,
I also want to be able to control the configuration of the DLL
independently of the configuration of the EXE.

Within the Business solution file, I have an app.config file which is
created as a result of adding project settings. When I compile
Business.dll, Business.dll.config duly appears in the bin folder of the
Business project. When I include the project into a client application
solution (I reference the source code rather than a reference to a DLL)
and compile the client application, the Business.dll.config file is not
copied across.

Within the Business.dll.config, all references to application settings
are handled using the My.Settings namespace. However, it appears that
when the DLL is compiled within a composite application, the default
settings from the project Settings.settings file are used, whether or
not the Business.dll.config file is present. This is obviously not the
behaviour that was required or expected.

Am I doing something fundamentally wrong, for example do I need to
access the app.config files using the configuration manager to access
the business.dll.config file explicitly?

Any help or pointers in the right direction gratefully received.

Thanks,
Brian
Re: My.Settings versus AppSettingsReader in solutions with multiple project config files Michel de Becdelièvre
11/26/2006 12:25:16 PM

<bri@northfieldbham.freeserve.co.uk> a écrit dans le message de news:
1164365563.008099.133300@45g2000cws.googlegroups.com...
[quoted text, click to view]

The way I'm handling this kind of trouble is by including external config
files in App.config / Web.config :
for instance :

<connectionStrings configSource="Base.config">
</connectionStrings>

<appSettings file="Commun.config">
</appSettings>

I believe this comes with a price : automatic detection of file change is
disabled.

AddThis Social Bookmark Button