473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 3133
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.