App.config

M

Michael

Ok, I'm totally confused...

I want to store my db connect strings in the app.config file. So I added an
app.config file and renamed it to MyApp.exe.config
Everything I've read says that it has to be located in the same dir as the
exe so I put it in the /bin directory. Now I run the app (in debug mode from
the IDE) and .... MyApp.exe.config is now gone!

Please point me in the right direction.
Thanks

Michael
 
Z

Zoury

Hi Micheal ! :O)

Simply don't rename/move the app.config file.

When you first add it to a project, it is created in the project location
(vbproj) with the name App.config. Then, when you build your application,
the file gets copied in the \bin directory with the following name format
[your app name].exe.config.

Thus, any changes you make to this file should be done in the App.config
file which will overwrite the \bin\[your app name].exe.config file at
"compile time".
 
M

Michael

Much thanks... the nothing I read told me anything about that..it all said
to add it to /bin

Michael
Zoury said:
Hi Micheal ! :O)

Simply don't rename/move the app.config file.

When you first add it to a project, it is created in the project location
(vbproj) with the name App.config. Then, when you build your application,
the file gets copied in the \bin directory with the following name format
[your app name].exe.config.

Thus, any changes you make to this file should be done in the App.config
file which will overwrite the \bin\[your app name].exe.config file at
"compile time".

--
Best Regards
Yanick
Michael said:
Ok, I'm totally confused...

I want to store my db connect strings in the app.config file. So I added an
app.config file and renamed it to MyApp.exe.config
Everything I've read says that it has to be located in the same dir as the
exe so I put it in the /bin directory. Now I run the app (in debug mode from
the IDE) and .... MyApp.exe.config is now gone!

Please point me in the right direction.
Thanks

Michael
 
M

Michael Earls

That's how you'd do it without Visual Studio. ;) VS.NET will do the work
for you.

--
Michael Earls
The Cerebral Kitchen
http://www.cerkit.com/


Michael said:
Much thanks... the nothing I read told me anything about that..it all said
to add it to /bin

Michael
Zoury said:
Hi Micheal ! :O)

Simply don't rename/move the app.config file.

When you first add it to a project, it is created in the project location
(vbproj) with the name App.config. Then, when you build your application,
the file gets copied in the \bin directory with the following name format
[your app name].exe.config.

Thus, any changes you make to this file should be done in the App.config
file which will overwrite the \bin\[your app name].exe.config file at
"compile time".

--
Best Regards
Yanick
Michael said:
Ok, I'm totally confused...

I want to store my db connect strings in the app.config file. So I
added an
app.config file and renamed it to MyApp.exe.config
Everything I've read says that it has to be located in the same dir as the
exe so I put it in the /bin directory. Now I run the app (in debug mode from
the IDE) and .... MyApp.exe.config is now gone!

Please point me in the right direction.
Thanks

Michael
 
A

_AnonCoward

If you compile from the command line and copy the binary to the /bin
directory yourself, then the manual steps you took would be appropriate.
However, you are in the IDE and it handles all of that for you. In fact,
I'm pretty sure that if you run your code from within the IDE, it is
running in the project folder, not the /bin, so it won't find your
..config file.


Ralf


"Michael" <xxx.xxx.xxx> wrote in message
: Much thanks... the nothing I read told me anything about that..it all
said
: to add it to /bin
:
: Michael
: "Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
: : > Hi Micheal ! :O)
: >
: > Simply don't rename/move the app.config file.
: >
: > When you first add it to a project, it is created in the project
location
: > (vbproj) with the name App.config. Then, when you build your
application,
: > the file gets copied in the \bin directory with the following name
format
: > [your app name].exe.config.
: >
: > Thus, any changes you make to this file should be done in the
App.config
: > file which will overwrite the \bin\[your app name].exe.config file
at
: > "compile time".
: >
: > --
: > Best Regards
: > Yanick
: > "Michael" <xxx.xxx.xxx> a écrit dans le message de
: > : > > Ok, I'm totally confused...
: > >
: > > I want to store my db connect strings in the app.config file. So I
added
: > an
: > > app.config file and renamed it to MyApp.exe.config
: > > Everything I've read says that it has to be located in the same
dir as
: > the
: > > exe so I put it in the /bin directory. Now I run the app (in debug
mode
: > from
: > > the IDE) and .... MyApp.exe.config is now gone!
: > >
: > > Please point me in the right direction.
: > > Thanks
: > >
: > > Michael
: > >
: > >
: >
: >
:
:
 

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