Microsoft KB Archive/822752

= Application configuration file is deleted when you build the solution =

Article ID: 822752

Article Last Modified on 12/11/2006

-

APPLIES TO


 * Microsoft Visual Basic 2005
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual C# 2005 Express Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual J# 2005 Express Edition
 * Microsoft Visual J# .NET 2003 Standard Edition

-





SYMPTOMS
When you build a solution (for example, a console application, a Microsoft Windows application, or a Microsoft Windows service) in Microsoft Visual Studio .NET 2003 or in Microsoft Visual Studio 2005, the application configuration file in the output folder is deleted.



CAUSE
This behavior may occur if you manually add the .exe.config file to the output folder or if you use Solution Explorer to add the  .exe.config file to the output folder.

Note  is a placeholder for the name of the application.



RESOLUTION
To avoid this behavior, add an application configuration file to your project, and then copy the contents of original configuration file to the new application configuration file. Follow these steps to add an application configuration file to the project:
 * 1) On Project menu, click Add New Item.
 * 2) In the Add New Item dialog box, under Templates, click Application configuration file. Make sure that the file name is App.config, and then click Open.
 * 3) Copy the contents of the original application configuration file to the new application configuration file.
 * 4) On Build menu, click Rebuild Solution.
 * 5) Verify the existence of the configuration file in the \Bin\Debug folder, and then verify the contents of the \Bin\Debug folder. If you build the solution in Release mode, check the contents of the configuration file in the \Bin\Release folder.

Note If you change the default name of the application configuration file to something different from App.config, the new name is added to your source files, and then the build system does not generate the output configuration file.



STATUS
This behavior is by design.



Steps to reproduce the behavior

 * 1) Start Visual Studio .NET or Visual Studio 2005.
 * 2) On the File menu, click New, and then click Project.
 * 3) Under Project Types, click Visual C# Projects, and then under Templates, click Console Application.

Note In Visual Studio 2005, click Visual C# under Project Types.
 * 1) In the Name box, name the project ConApp . Click OK.
 * 2) On the Build menu, click Build Solution.
 * 3) Create a configuration file or a simple text file in the  \Bin\Debug folder, and then rename the file ConApp.exe.config . If you build the solution in Release mode, create a configuration file in the  \Bin\Release folder.
 * 4) On the Build menu, click Rebuild Solution.
 * 5) Verify the existence of the ConApp.exe.config file in the  \Bin\Debug folder. You notice that the file may not be in the folder. If you build the solution in Release mode, verify the existence of the ConApp.exe.config file in the  \Bin\Release folder.

Additional query words: delete

Keywords: kbvs2005swept kbvs2005applies kbprb kbconfig kbideproject KB822752

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.