Home All Groups Group Topic Archive Search About

app.config xml file and application blocks

Author
15 Nov 2004 7:56 PM
grs
Can a class library have a app.config file. Reason for asking is that the
microsoft application blocks all read from myApp.exe.config. How can you use
the application blocks if you do not have an app.config file.

Wish someone from microsoft would answer this, I am at a loss.

thanks
grs

Author
15 Nov 2004 8:22 PM
Christoph Schittko [MVP]
Yes, a class library can have .config file, but you have to do the
copying and naming by hand. Visual Studio only renames and copies
app.config files automatically for you.

As you already found, that behavior is not really documented and the
expected usage is to add settings for the application blocks to the
app.config/web.config file of your application. As a developer/vendor of
a class library, you need to document these expectations when you only
ship a library, which is what Microsoft does with WSE for example.

What exactly are you looking to do?

HTH,
Christoph Schittko
MS MVP XML
http://weblogs.asp.net/cschittko


Show quote
> -----Original Message-----
> From: grs [mailto:gsm***@budgetext.com]
> Posted At: Monday, November 15, 2004 1:57 PM
> Posted To: microsoft.public.dotnet.xml
> Conversation: app.config xml file and application blocks
> Subject: app.config xml file and application blocks
>
> Can a class library have a app.config file. Reason for asking is that
the
> microsoft application blocks all read from myApp.exe.config. How can
you
> use
> the application blocks if you do not have an app.config file.
>
> Wish someone from microsoft would answer this, I am at a loss.
>
> thanks
> grs
Author
15 Nov 2004 9:42 PM
grs
Christoph,
thanks for reply.  "What exactly are you looking to do?" = I wish to use the
exception management application block in a class library.  Would the
application block read the config settings - what would I name the config
file ?? Any example would really would be appreciated.

thanks
grs

Show quote
"Christoph Schittko [MVP]" <INVALIDEM***@austin.rr.com> wrote in message
news:O9TClD1yEHA.3024@TK2MSFTNGP14.phx.gbl...
> Yes, a class library can have .config file, but you have to do the
> copying and naming by hand. Visual Studio only renames and copies
> app.config files automatically for you.
>
> As you already found, that behavior is not really documented and the
> expected usage is to add settings for the application blocks to the
> app.config/web.config file of your application. As a developer/vendor of
> a class library, you need to document these expectations when you only
> ship a library, which is what Microsoft does with WSE for example.
>
> What exactly are you looking to do?
>
> HTH,
> Christoph Schittko
> MS MVP XML
> http://weblogs.asp.net/cschittko
>
>
> > -----Original Message-----
> > From: grs [mailto:gsm***@budgetext.com]
> > Posted At: Monday, November 15, 2004 1:57 PM
> > Posted To: microsoft.public.dotnet.xml
> > Conversation: app.config xml file and application blocks
> > Subject: app.config xml file and application blocks
> >
> > Can a class library have a app.config file. Reason for asking is that
> the
> > microsoft application blocks all read from myApp.exe.config. How can
> you
> > use
> > the application blocks if you do not have an app.config file.
> >
> > Wish someone from microsoft would answer this, I am at a loss.
> >
> > thanks
> > grs
>
>
Author
16 Nov 2004 4:03 AM
Christoph Schittko [MVP]
I swear I loaded .dll.config files before for assemblies back in the
..net 1.0 days but I guess it wasn't intended behavior and it's no longer
working.

To use the exception management block you need to add the required
configuration elements in the app.config or the web.config file of the
executing application or web service.

If you don't build that app.config file because you're using the
exception management block in a class library assembly, not in an
application, then you need to document that requirement for the
developers that consume your class library.

I apologize for any confusion.

Christoph

Show quote
> -----Original Message-----
> From: grs [mailto:gsm***@budgetext.com]
> Posted At: Monday, November 15, 2004 3:43 PM
> Posted To: microsoft.public.dotnet.xml
> Conversation: app.config xml file and application blocks
> Subject: Re: app.config xml file and application blocks
>
> Christoph,
> thanks for reply.  "What exactly are you looking to do?" = I wish to
use
> the
> exception management application block in a class library.  Would the
> application block read the config settings - what would I name the
config
> file ?? Any example would really would be appreciated.
>
> thanks
> grs
>
> "Christoph Schittko [MVP]" <INVALIDEM***@austin.rr.com> wrote in
message
> news:O9TClD1yEHA.3024@TK2MSFTNGP14.phx.gbl...
> > Yes, a class library can have .config file, but you have to do the
> > copying and naming by hand. Visual Studio only renames and copies
> > app.config files automatically for you.
> >
> > As you already found, that behavior is not really documented and the
> > expected usage is to add settings for the application blocks to the
> > app.config/web.config file of your application. As a
developer/vendor of
Show quote
> > a class library, you need to document these expectations when you
only
> > ship a library, which is what Microsoft does with WSE for example.
> >
> > What exactly are you looking to do?
> >
> > HTH,
> > Christoph Schittko
> > MS MVP XML
> > http://weblogs.asp.net/cschittko
> >
> >
> > > -----Original Message-----
> > > From: grs [mailto:gsm***@budgetext.com]
> > > Posted At: Monday, November 15, 2004 1:57 PM
> > > Posted To: microsoft.public.dotnet.xml
> > > Conversation: app.config xml file and application blocks
> > > Subject: app.config xml file and application blocks
> > >
> > > Can a class library have a app.config file. Reason for asking is
that
> > the
> > > microsoft application blocks all read from myApp.exe.config. How
can
> > you
> > > use
> > > the application blocks if you do not have an app.config file.
> > >
> > > Wish someone from microsoft would answer this, I am at a loss.
> > >
> > > thanks
> > > grs
> >
> >
Author
16 Nov 2004 9:13 AM
Marc Scheuner [MVP ADSI]
>Yes, a class library can have .config file,

Well, sort of - but the basic ConfigurationSettings object will *NOT*
look at an class library's "app.config" file - it will only ever look
at the app's "myapp.exe.config" file.

So if you want to use a config file for a DLL or something like that,
you have to do all the evaluation of the XML config file yourself.

Marc
================================================================
Marc Scheuner                        May The Source Be With You!
Bern, Switzerland                         m.scheuner(at)inova.ch

AddThis Social Bookmark Button