471,338 Members | 1,012 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

app.config file disappearing

I'm having a weird bug and wondering if anyone has ever seen this before

A Hello World GUI app. Create an app.config. When you build, Studio copies
app.config to bin\debug\ and renames it to the name of your EXE (sorta; turns
out if your app is in a namespace, Studio names your EXE after the entire
namespace but names your config file to only the app name and not the full
namespace path, which in turn means your EXE cannot find it's config file
despite Studio automatically generating it)

This is what happened for me for the first hour or two. After that it
stopped copying the file, causing me to get errors that took me a little
while to figure out (debuging config file problems in ASP.NET is a
nightmare). So i manually copied a config file to the bin\debug directory.
Which is where i learned the second part of my problem - every time i run the
application, Studio goes to the bin\debug directory and erases the file i put
there

The only way i can get the application to run is to start it and then, once
it starts, manually copy a config file to that directory and rename it to the
proper thing. Any time i forget, my app blows up

Any ideas?

-baylor
Jul 21 '05 #1
3 3018
For non-web apps, the config file will be deleted from the bin folder
during a build. The app.config file will be copied to the bin folder
and renamed. I have never seen the issue you describe where the
namespace causes the config file to be named incorrectly, and was unable
to reproduce. I'm using C# - maybe it is an issue with VB.NET? You may
need to provide more details about your situation.

I'm a little concerned by your mention of debugging ASP.NET. What does
that have to do with this? Is your project a WinForms application or a
web application? For web applications, you do not use app.config - you
use web.config, and it does not go in the bin folder.
baylor wrote:
I'm having a weird bug and wondering if anyone has ever seen this before

A Hello World GUI app. Create an app.config. When you build, Studio copies
app.config to bin\debug\ and renames it to the name of your EXE (sorta; turns
out if your app is in a namespace, Studio names your EXE after the entire
namespace but names your config file to only the app name and not the full
namespace path, which in turn means your EXE cannot find it's config file
despite Studio automatically generating it)

This is what happened for me for the first hour or two. After that it
stopped copying the file, causing me to get errors that took me a little
while to figure out (debuging config file problems in ASP.NET is a
nightmare). So i manually copied a config file to the bin\debug directory.
Which is where i learned the second part of my problem - every time i run the
application, Studio goes to the bin\debug directory and erases the file i put
there

The only way i can get the application to run is to start it and then, once
it starts, manually copy a config file to that directory and rename it to the
proper thing. Any time i forget, my app blows up

Any ideas?

-baylor

Jul 21 '05 #2
Yes, i was unclear about what i'm doing. i am writing a WinForms application
in C# to test a component i'm using in ASP.NET application. It is easier to
debug it in WinForms so i created a test project to do that. But this
particular problem has nothing to do with ASP.NET

i have a simple Hello World app. In the same directory as the project file
is app.config. When i build or run, the app.config would be copied to the
bin\debug folder and get renamed test.exe.config

An hour or two into doing this, Studio stopped copying and renaming
app.config. App.config was still getting copied, but only because i had a
post-build step to copy all config files over (enterprise library, which i'm
testing, uses a lot of config files). If i remove the post-build event,
app.config does not get copied over at all

What i don't understand is why this worked and then suddenly stopped. It
would make more sense if it had never worked. i did not change anything
significant before it stopped. Specifically, i'm changing a line or two in a
different config file (using the MSEL config tool) and then rerunning.
Somewhere over the course of a dozen or two config file edits Studio stopped
copying over the app.config file

When i manually move the config file to bin\debug and rename it, it gets
erased every time i run. From your description, it sounds like that is
expected behavior

i built a new project and that one never copies over app.config. i've spent
a couple more hours looking at this and realized that if i go to the Solution
Explorer, right-click and do Add->Add Existing Item... i can manually add
app.config to the list of files displaying in Solution Explorer, at which
point everything works again. Which maybe is what i should have been doing
the entire time and simply didn't know that. But then i'm not sure why it was
copying over the file for the first few hours. Maybe i'm simply delusional
after too many hours of staring at my screen

-baylor
Jul 21 '05 #3
Yes, as far as I understand it, the app.config file needs to be part of the
project to get copied over to the build destination folder upon a compile.

Erasing the .config file form the build destination folder upon a build is a
standard action.

"baylor" <ba****@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com...
Yes, i was unclear about what i'm doing. i am writing a WinForms
application
in C# to test a component i'm using in ASP.NET application. It is easier
to
debug it in WinForms so i created a test project to do that. But this
particular problem has nothing to do with ASP.NET

i have a simple Hello World app. In the same directory as the project file
is app.config. When i build or run, the app.config would be copied to the
bin\debug folder and get renamed test.exe.config

An hour or two into doing this, Studio stopped copying and renaming
app.config. App.config was still getting copied, but only because i had a
post-build step to copy all config files over (enterprise library, which
i'm
testing, uses a lot of config files). If i remove the post-build event,
app.config does not get copied over at all

What i don't understand is why this worked and then suddenly stopped. It
would make more sense if it had never worked. i did not change anything
significant before it stopped. Specifically, i'm changing a line or two in
a
different config file (using the MSEL config tool) and then rerunning.
Somewhere over the course of a dozen or two config file edits Studio
stopped
copying over the app.config file

When i manually move the config file to bin\debug and rename it, it gets
erased every time i run. From your description, it sounds like that is
expected behavior

i built a new project and that one never copies over app.config. i've
spent
a couple more hours looking at this and realized that if i go to the
Solution
Explorer, right-click and do Add->Add Existing Item... i can manually add
app.config to the list of files displaying in Solution Explorer, at which
point everything works again. Which maybe is what i should have been doing
the entire time and simply didn't know that. But then i'm not sure why it
was
copying over the file for the first few hours. Maybe i'm simply delusional
after too many hours of staring at my screen

-baylor

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Maxim Khesin | last post: by
2 posts views Thread by Suresh Gladstone | last post: by
4 posts views Thread by Adam Smith | last post: by
2 posts views Thread by Rachel Suddeth | last post: by
3 posts views Thread by baylor | last post: by
3 posts views Thread by Blasting Cap | 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.