VS.Net 2003: Where is the .config file? by: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
|
| | Reply: by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])
|
| | 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.
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/>
|
| | Reply: by:feng
|
| | 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
|
| | Reply: by:Jay B. Harlow [MVP - Outlook]
|
| | 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
|
| | Reply: by:feng
|
| | 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!
|
| | Reply: by:Jay B. Harlow [MVP - Outlook]
|
| | 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
|
0 Comments:
Post a Comment
<< Home