App.config

  • Thread starter Thread starter Christoph Boget
  • Start date Start date
C

Christoph Boget

How do you utilize the "app.config" file? I am using a
freeware utility that spits one out (along with the code
to access it) but I'm not sure where the file needs to go.
Everything I've tried thus far (adding it to my project,
moving it to the directory where the executable runs, etc)
has failed. Is there something special I need to do or
somewhere specific I need to put the file?

thnx,
Christoph
 
How do you utilize the "app.config" file? I am using a
freeware utility that spits one out (along with the code
to access it) but I'm not sure where the file needs to go.
Everything I've tried thus far (adding it to my project,
moving it to the directory where the executable runs, etc)
has failed. Is there something special I need to do or
somewhere specific I need to put the file?

If you're using VS.NET, the file named "App.Config" (when part of your
VS.NET project) automatically gets renamed to "<exe_name>.exe.config"
and placed in the same directory as your exe (where it needs to be).
 
How do you utilize the "app.config" file? I am using a
freeware utility that spits one out (along with the code
to access it) but I'm not sure where the file needs to go.
Everything I've tried thus far (adding it to my project,
moving it to the directory where the executable runs, etc)
has failed. Is there something special I need to do or
somewhere specific I need to put the file?

thnx,
Christoph

You need to use a specific naming convention. If say your exe file is
called somefile.exe, the config file needs to be named
somefile.exe.config
 
If you're using VS.NET, the file named "App.Config" (when part of your
VS.NET project) automatically gets renamed to "<exe_name>.exe.config"
and placed in the same directory as your exe (where it needs to be).

Will it do the same if you are creating a DLL (that uses the
AppSettingsReader)?
Because it doesn't appear to be...

thnx,
Christoph
 
You need to use a specific naming convention. If say your exe file is
called somefile.exe, the config file needs to be named
somefile.exe.config

At runtime - yes - but *NOT* in your VS.NET Project ! In your project,
add a text file called "app.config" (exactly that !!) and then VS.NET
will automagically rename it to "yourapp.exe.config" and place it in
the compiler output directory for you.

Marc
 
Back
Top