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

Where is the app.exe.config supposed to go?

P: n/a
I have a test application that is calling an assembly that reads some
strings out of a config file. Normally, this assembly supports a web
application and the information can be read just fine. Then I created a C#
test application and ran the function. The function fails because the
configuration read is failing to find a key. I created an application config
and copied the keys over to the app config file but the app is still failing
to find the keys. It isn't clear what the problem is. Maybe the app is not
finding the config file or perhaps there's something else going on. Where
should the app exe config go?

Here's the situation:

Dev Studio 2003.
D:\Projects\A\bin contains a dozen different assemblies that the test
program needs.
Test program is output to D:\Projects\A\bin.
Name of test program is TestAccount.exe.
Name of app config is TestAccount.exe.config.

When I put the config in D:\Projects\A\bin, the application throws an error
because it can't read a key from the config file.
Oddly, after the program has run, the config file is no longer present in
D:\Projects\A\bin. Could it be that the config file is getting deleted as
soon as the program tries to read the key?
Thinking that maybe the executable's directory wasn't the right place, I
tried other places (Windows, Windows\System32 and a bunch of other places)
but that didn't seem to work.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
Feb 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The problem is that the TestAccount.exe.config file is being deleted
sometime soon after TestAccount.exe starts. Does this ring a bell with
anyone?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
I have a test application that is calling an assembly that reads some
strings out of a config file. Normally, this assembly supports a web
application and the information can be read just fine. Then I created a C#
test application and ran the function. The function fails because the
configuration read is failing to find a key. I created an application
config and copied the keys over to the app config file but the app is still
failing to find the keys. It isn't clear what the problem is. Maybe the app
is not finding the config file or perhaps there's something else going on.
Where should the app exe config go?

Here's the situation:

Dev Studio 2003.
D:\Projects\A\bin contains a dozen different assemblies that the test
program needs.
Test program is output to D:\Projects\A\bin.
Name of test program is TestAccount.exe.
Name of app config is TestAccount.exe.config.

When I put the config in D:\Projects\A\bin, the application throws an
error because it can't read a key from the config file.
Oddly, after the program has run, the config file is no longer present in
D:\Projects\A\bin. Could it be that the config file is getting deleted as
soon as the program tries to read the key?
Thinking that maybe the executable's directory wasn't the right place, I
tried other places (Windows, Windows\System32 and a bunch of other places)
but that didn't seem to work.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

Feb 6 '06 #2

P: n/a
Never mind. Figured it out.

Here's what I did wrong - I renamed the app.config to
TestAccount.exe.config. What I didn't know was that Dev Studio will
automatically output the contents of app.config to TestAccount.exe.config in
the project's output directory. What I'm guessing is, Dev Studio recognized
that an app config existed but, because I'd renamed the file in the
solution, Dev Studio was deleting the TestAccount.exe.config in the output
directory but was failing when it tried to rename app.config to
TestAccount.exe.config. Anyway, once I'd renamed the config in the solution
back to the default name, things worked better.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
The problem is that the TestAccount.exe.config file is being deleted
sometime soon after TestAccount.exe starts. Does this ring a bell with
anyone?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
I have a test application that is calling an assembly that reads some
strings out of a config file. Normally, this assembly supports a web
application and the information can be read just fine. Then I created a C#
test application and ran the function. The function fails because the
configuration read is failing to find a key. I created an application
config and copied the keys over to the app config file but the app is
still failing to find the keys. It isn't clear what the problem is. Maybe
the app is not finding the config file or perhaps there's something else
going on. Where should the app exe config go?

Here's the situation:

Dev Studio 2003.
D:\Projects\A\bin contains a dozen different assemblies that the test
program needs.
Test program is output to D:\Projects\A\bin.
Name of test program is TestAccount.exe.
Name of app config is TestAccount.exe.config.

When I put the config in D:\Projects\A\bin, the application throws an
error because it can't read a key from the config file.
Oddly, after the program has run, the config file is no longer present in
D:\Projects\A\bin. Could it be that the config file is getting deleted as
soon as the program tries to read the key?
Thinking that maybe the executable's directory wasn't the right place, I
tried other places (Windows, Windows\System32 and a bunch of other
places) but that didn't seem to work.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com


Feb 6 '06 #3

P: n/a
Application config file must reside in the application folder (where the
executable is)
--

Stoitcho Goutsev (100)

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
I have a test application that is calling an assembly that reads some
strings out of a config file. Normally, this assembly supports a web
application and the information can be read just fine. Then I created a C#
test application and ran the function. The function fails because the
configuration read is failing to find a key. I created an application
config and copied the keys over to the app config file but the app is still
failing to find the keys. It isn't clear what the problem is. Maybe the app
is not finding the config file or perhaps there's something else going on.
Where should the app exe config go?

Here's the situation:

Dev Studio 2003.
D:\Projects\A\bin contains a dozen different assemblies that the test
program needs.
Test program is output to D:\Projects\A\bin.
Name of test program is TestAccount.exe.
Name of app config is TestAccount.exe.config.

When I put the config in D:\Projects\A\bin, the application throws an
error because it can't read a key from the config file.
Oddly, after the program has run, the config file is no longer present in
D:\Projects\A\bin. Could it be that the config file is getting deleted as
soon as the program tries to read the key?
Thinking that maybe the executable's directory wasn't the right place, I
tried other places (Windows, Windows\System32 and a bunch of other places)
but that didn't seem to work.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

Feb 6 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.