471,310 Members | 1,385 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

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

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
3 3630
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
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
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.

Similar topics

16 posts views Thread by DraguVaso | last post: by
5 posts views Thread by Paul Daly (MCP) | last post: by
2 posts views Thread by Richard | last post: by
1 post views Thread by savajx1 | last post: by
20 posts views Thread by tomerfiliba | last post: by
10 posts views Thread by eagle | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.