none
App.Config on build

    Question

  • I have yet to find anywhere that explains why App.config gets renamed to ApplicationName.exe.config when a project is built in Visual Studio, does anyone know where I can find a resource that explains this?  Also, are there any changes that are made to the file other than the name?
    Monday, October 02, 2006 3:13 PM

Answers

  • "While the configuration file for a Windows application is often referred to as the app.config file, the actual file name is based on the name of the application itself. For instance, if the application name is myprogram.exe, then the configuration file name will be myprogram.exe.config. This file must be in the same directory as myprogram.exe.

    The reason that the file is often referred to as the app.config file is that in Visual Studio® .NET, the project file is actually named App.config. When we build the project, Visual Studio .NET creates a copy of App.config in the bin directory with the appropriate name based on the application file name." - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet04222003.asp

    Seems to be that visual studio likes to work with the name app.cofig while the actual file after building needs to be  AppName.exe.config.

    Monday, October 02, 2006 6:35 PM

All replies

  • "While the configuration file for a Windows application is often referred to as the app.config file, the actual file name is based on the name of the application itself. For instance, if the application name is myprogram.exe, then the configuration file name will be myprogram.exe.config. This file must be in the same directory as myprogram.exe.

    The reason that the file is often referred to as the app.config file is that in Visual Studio® .NET, the project file is actually named App.config. When we build the project, Visual Studio .NET creates a copy of App.config in the bin directory with the appropriate name based on the application file name." - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet04222003.asp

    Seems to be that visual studio likes to work with the name app.cofig while the actual file after building needs to be  AppName.exe.config.

    Monday, October 02, 2006 6:35 PM
  • Chris, is there any special consideration when it comes to Windows Server 2003?  On any XP machine, [Application].exe.config works correctly, however, on every Windows Server 2003 machine I use, the file must be named [Application].config in order for the application to read the configuration.

     

    I have performed an extensive search about this issue, but can't find anything.  Thank you.

    Thursday, April 26, 2007 5:47 PM
  • It is hard to believe that no one else has ever come across this issue.  The documentation for the ConfigurationManager class states that it is supported on Windows Server 2003.  Still no ideas from anyone?
    Friday, April 27, 2007 2:31 PM
  • This link is now broken.

     

    Saturday, October 06, 2007 12:58 AM
  • When you rename app.config in Visual Studio 2005 project and build, Visual Studio no longer produces ApplicationName.exe.config in .\bin\Debug folder.
    Is this a known issue in Visual Studio? It's kind of stupid. I prefer to name app.config to the actual ApplicationName.exe.config right in the project. Now, I don't see ApplicationName.exe.config in .\bin\Debug after I build the project.
    Friday, November 09, 2007 9:35 PM


  • Well, it seems that App.config is getting copied to bin with the following file names

    1. [ApplicationName].exe.config
    2. [ApplicationName].vshost.exe.config

    Any idea on; why the second file is getting created at the build process?

    Saswata Purkayastha
    Monday, June 09, 2008 4:46 PM
  • Because the visual studio hosting process is [ApplicationName].vshost.exe, so it generates a config for both the hosting process and your normal output.
    Friday, January 14, 2011 11:34 PM