Magic of Windows Forms App.config in VS.NET
For ASP.NET developers who are used to name their configuration files “web.config” , working with configuration files of Windows forms application in VS.NET is a little bit tricky. Let’s assume that you have an application called “TestConig” which generates the executable TestConig.exe. If you ever decide to add a config file to this app using visual studio ,there are couple of things to remember:
1) Add an new item to your project and name it App.config which is basically nothing more than an XML file.
2)Build your project and look in the build output directory. The binRelease or binDebug directory for C# projects
Surprisingly you’ll see that there is a file called TestConig.exe.config and App.config is not what the configuration file ends up getting called, this is just what it’s called inside a Visual Studio .NET project.
I guess the question is that why VS.NET behaves like that? and the answer is simple:
TestConig.exe.config file is a copy of the App.Config file.VS.NET copies it so that you don’t need to maintain a separate debug and release version of this file. And they use the name TestConig.exe.config because that’s the magic name they’ve chosen for this behavior
Deployment: In deployment you need to make sure that the App.config file is renamed TestConig.exe.config or just simply pick up TestConig.exe.config from debug or release folder.