Re: App.config question. Me is stuck good :-(

From: Madhu[C#-MVP] (madhusudhanan_p_at_hotmail.com)
Date: 12/03/04


Date: Fri, 3 Dec 2004 12:19:08 -0000

Hi,

Let me first get your problem correctly... You have a 4 projects, 1 which is
Windows Forms App and the other three class librarires. I assume it is going
to be DLL (basically in-process).

So in that case, you just have to have your application configuration in the
Windows Forms Application which will have the process of its own and all the
class libraries will be loaded into this process. The class libraries will
use the configuration file of the surrogate process which in this case is
the Windows forms App. You can just use the following code segment to access
the appsettings.

ConfigurationSettings.AppSettings[<appsettings-element>]

I guess this way you don't have to worry about multiple configuration files.

Hope this helps...

Regards,
Madhu

MCSD.NET | C# - MVP

"Simon" <sh856531@microsofts_free_email_service.com> wrote in message
news:%23AL7F4S2EHA.3640@tk2msftngp13.phx.gbl...
> Hi everyone,
>
> I really need help with the following:
>
> It's common in app development to create numerous projects under one
> solution that as a whole combine to become your final application. For
> example I have a solution that has four subprojects - 3 class libraries
> and 1 windows forms app.
>
> Q - Some of these projects - both class library and win form application
> require access to a config file. In one of the projects - the one that
> supports data access I use the line below to access a custom config
> section:
>
> ChaosDataConfiguration config =
> (ChaosDataConfiguration)ConfigurationSettings.GetConfig("TheChaosLibraries/DataProviderSettings");
>
> The problem I'm having is I don't know if this is going to work. Should
> the App.config file be placed under the data projects directory, or is
> there some way to create a single config file at the root of the solution
> and have all projects access that?
>
> Any help would be greatfully received.
>
> Thanks all
>
>>I do not think that one config file can be used by more then one
>> application. Remember, the config file has to be named the same as
>> program
>> for it to load.
>>
>> "Simon" <sh856531@microsofts_free_email_service.com> wrote in message
>> news:uK0vvWK2EHA.524@TK2MSFTNGP09.phx.gbl...
>>> Hi all,
>>>
>>> When you make a solution that contains numerous projects - where should
>> you
>>> put the configuration file that should be used for the application?
>>>
>>> Example:
>>>
>>> An application called MyApp has 4 projects each contained within their
>>> own
>>> subdirectories. Each project outputs its dll to its own bin directory.
>>>
>>> The folder structure is:
>>>
>>> MyApp
>>> - MyProject 1
>>> - MyProject 2
>>> - MyProject 3
>>> - MyProject 4
>>>
>>> Where should I put the config file so that all the projects access it?
>>>
>>> Is it even possible to have a single config file shared amongst multiple
>>> projects? I'm sure it is - I just can't find any details on how to do
>>> it.
>>>
>>> If anyone has any advice on this I would appreciate it very much
>>>
>>> Thanks in advance everyone
>>>
>>> Simon
>>>
>>>
>>
>>
>
>



Relevant Pages

  • Re: App.config question. Me is stuck good :-(
    ... Windows Forms App and the other three class librarires. ... class libraries will be loaded into this process. ... > require access to a config file. ...
    (microsoft.public.dotnet.general)
  • Re: asp.net connection to sql server?
    ... It is a good idea to separate the connectionstring from the program code by ... putting it into a config file, ... asp.net application where it's not using just one generic windows ... users to access the asp.net app from anywhere on the web? ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: asp.net connection to sql server?
    ... by putting it into a config file, ... Thanks a bunch Scott for your info and quick reply. ... asp.net application where it's not using just one generic windows ... authentication for users to access the asp.net app from anywhere on the ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Impersonation in ASP.NET 2.0 (works from XP, not 2003)
    ... We need to access remote fileshares from our app, ... it is required on Windows XP for the app to function ... having this line in the config file gives an ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: CLI-kiddies/advocates ?
    ... On Sun, 27 Nov 2005 20:01:55 GMT, Aragorn staggered into the Black Sun ... all the 4.n Xs are supposed to use the same config file format. ... having may be due to compatability libraries, or if the app is really ... post the error messages from the problem app's startup. ...
    (comp.os.linux.misc)