472,795 Members | 2,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,795 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 3749
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: DraguVaso | last post by:
Hi, I have a Windows Service running (made in VB.NET), and wanted to be able to change from time to time some parameters by changing them in the App.config. But it seems that the application...
5
by: Paul Daly (MCP) | last post by:
I've created a windows forms appliation that gets its data from a sql database. I want to create an app.config file for this application so that in the event that the server name changes, they...
2
by: Richard | last post by:
Hi, I'm having trouble setting up a config file based trace switch & listener. I added an application config file to my console based C# program using the "Add New Application Config File" button...
4
by: feng | last post by:
..Net's .config file is supposed to replace the .ini files. That's all fine if all I need is to read from it. But what if I need both read and write? With .ini file, I can do that very easily with...
1
by: savajx1 | last post by:
I am using the new "web deployment addin" in VS 2005 to output my web site. The web site is correctly output (assemblies generated in the \bin subdirectory). The web site on my developement...
20
by: tomerfiliba | last post by:
hey i've been seeing lots of config-file-readers for python. be it ConfigObj (http://www.voidspace.org.uk/python/configobj.html) or the like. seems like a trend to me. i came to this conclusion...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
7
by: moondaddy | last post by:
I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error: {"The type initializer for...
10
by: eagle | last post by:
I have a web.config in my application that contains the connection strings to all my datasources. I want to move these connection strings to another web config up the folder hierarchy so that all...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.