config files question for console apps / windows apps

J

jai hanuman

hi,
where can you set the "startup" directory for the config files? (like
in the ini days). In those days, the project directory would be the
startup and search path for the ini files.

now however, i found that the myapp.exe.config does not get picked
from the folder where myapp.csproj is. It seems to pick it up only
from myapp/bin/debug (or release) folder (when in the IDE). When
i copy the config file there, on every compile it cleans out the folder
and deletes the config file.

In the program i tried to set the AppDomainSetup.ConfigurationFile
to two levels up, but it just ignores that change and the directory
path after the call remains the same as before.

Question: how do you get you program to read the config from the
project root? I do not want a hack (post-build step) to copy the
config to bin/debug.

Thanks a lot.
 
G

Guest

If you are using VS.NET 2003 you can add an app.config file to your project

This 'is' your configuration file - it will be renamed to the correct name of your application.exe.config and copied to the debug or release folder automatically

HT

RS
 
N

Nico Debeuckelaere

..NET always takes the config from the same directory as where the exe is
located.
But you can add a config file into your project.
In VB.NET it will be named app.config.
During build ... .NET will copy this file to the same directory as the EXE
and rename it as blabla.exe.config

Regards,

--

Nico Debeuckelaere

ND-Sign BVBA (Microsoft Certified Partner since 2004)
URL: http://www.nd-sign.com
== ND-Sign, Designed for you ==
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top