By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,166 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,166 IT Pros & Developers. It's quick & easy.

App.config

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
news:Ov**************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #2

P: n/a
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
news:O2**************@TK2MSFTNGP15.phx.gbl...
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
news:Ov**************@tk2msftngp13.phx.gbl...
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


Nov 21 '05 #3

P: n/a
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" <xxx.xxx.xxx> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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
news:O2**************@TK2MSFTNGP15.phx.gbl...
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
news:Ov**************@tk2msftngp13.phx.gbl...
> 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
>
>



Nov 21 '05 #4

P: n/a
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
news:%2****************@TK2MSFTNGP09.phx.gbl...
: 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
: news:O2**************@TK2MSFTNGP15.phx.gbl...
: > 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
: > news:Ov**************@tk2msftngp13.phx.gbl...
: > > 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
: > >
: > >
: >
: >
:
:

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.