VS.Net 2003: Where is the .config file?

  • Thread starter Thread starter feng
  • Start date Start date
F

feng

Hi,

We just converted our VB.Net Windows exe project from
VS.Net 2002 to VS.Net 2003 and ran into a problem. the
MyApp.exe.config file that we use for our customized
configuration settings is removed when the conversion is
done. It won't work even if I menully copy the file back.
The settings are not get recogenized. What's going on?

Thanks
 
* "feng said:
We just converted our VB.Net Windows exe project from
VS.Net 2002 to VS.Net 2003 and ran into a problem. the
MyApp.exe.config file that we use for our customized
configuration settings is removed when the conversion is
done. It won't work even if I menully copy the file back.
The settings are not get recogenized. What's going on?

Change the file name to "App.config" and put it into the project's
source code directory. Then add the file to the project. VS.NET 2003
will copy the file to the "bin" directory automatically when building
the solution and rename it appropriately.
 
Thanks for your reply!

I tried exactly what you said but I still couldn't get the
VS.Net 2003 to copy and rename my App.config file into my
bin directory. When adding the config file to the project,
I tried all 4 types of "Build Action" but none of those
worked. After rebuilding the solution, the config file
never get generited in the project's bin directory. The
only way to make the code work is to menully copy the file
into bin AFTER rebuilding (copy file before rebuilding
won't work because rebuilding will remove it from bin) and
properly rename it.

What am I doing wrong here?

Thanks again.

feng
 
feng,
The app.config file needs to be in the root of your VS.NET project (not in
any subfolders!), it needs to be called literally "app.config" without the
quotes. The build action can be left to None.

The project needs to be an Executable project an EXE.

The easiest way to create a properly named app.config in your project is to
use "Project - Add New Item - Application Configuration File".

Hope this helps
Jay
 
Thank you so much Jay! It works this time!

It's a little wired though that the file has to be
named "app.config" and has to be located in the root. I
don't know how many people appreciate this "new feature"
of VS.Net 2003. :)

Thank you again for your great help!
-----Original Message-----
feng,
The app.config file needs to be in the root of your VS.NET project (not in
any subfolders!), it needs to be called
literally "app.config" without the
 
feng,
It's a little wired though that the file has to be
named "app.config" and has to be located in the root.
Its not really that weird, as VS.NET needs to find it.

Remember that VS.NET 2003 has the ability to set which version of the
runtime should be used, to do this it needs to modify the app.config file,
to find the app.config file it needs to be well known in a known place in
your project, the most logical place is the root. Otherwise VS.NET would
need to recurse the entire project structure looking for the file, if you
have an obnoxiously large project this may take time. Hence its in the root.

VS.NET 2002 will also copy the app.config from the root folder into the
output folder, however it cannot modify the runtime version.

Hope this helps
Jay
 
Back
Top