Re: App.config question. Me is stuck good :-(
From: Madhu[C#-MVP] (madhusudhanan_p_at_hotmail.com)
Date: 12/03/04
- Next message: Nay Myo Aung: "Re: Possible TRY...CATCH...END TRY"
- Previous message: Ollie: "Re: Possible TRY...CATCH...END TRY"
- In reply to: Simon: "App.config question. Me is stuck good :-("
- Next in thread: Simon: "Re: App.config question. Me is stuck good :-("
- Reply: Simon: "Re: App.config question. Me is stuck good :-("
- Messages sorted by: [ date ] [ thread ]
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
>>>
>>>
>>
>>
>
>
- Next message: Nay Myo Aung: "Re: Possible TRY...CATCH...END TRY"
- Previous message: Ollie: "Re: Possible TRY...CATCH...END TRY"
- In reply to: Simon: "App.config question. Me is stuck good :-("
- Next in thread: Simon: "Re: App.config question. Me is stuck good :-("
- Reply: Simon: "Re: App.config question. Me is stuck good :-("
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|