472,958 Members | 1,852 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,958 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 3108
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Maxim Khesin | last post by:
I want to have a config file with my python proggie, satisfying the following requirements: 1) support key->(value, default) 2) simple and intuitive to read and edit 3) easyly readable into a...
4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
2
by: Suresh Gladstone | last post by:
Hi, This is a bit with versioning and installation of the .NET dlls. I want to perform the following, 1. A third party application will be invoking my .NET dll through COM interop . For this I...
4
by: Adam Smith | last post by:
Whenever I try to start my service application, the config file is erased and I get an application exception trying to read it. When I make it read only, everything is fine. Anyone know why...
2
by: Rachel Suddeth | last post by:
Here is my scenario: I have a few custom controls that I set up on a form and tested setting properties and appearances. Then I added a couple references to the project which add classes I need to...
3
by: baylor | last post by:
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...
3
by: Blasting Cap | last post by:
I am working on a web app that I want to be able to use a separate config file on, in addition to the web.config file that's already working in the application. If I put the following in the...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 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: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.