Reza on blogging [MVP]

THIS BLOG HAS MOVED TO: http://blogs.devhorizon.com/reza

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News



toronto.sharepoint.camp


Navigation

Post Categories

Other Bloggers

Personal Links

Wednesday, August 30, 2006 - Posts

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 bin\Release or bin\Debug 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.

posted Wednesday, August 30, 2006 1:58 PM by admin with 0 Comments

Powered by Community Server, by Telligent Systems