Cover

App.config and C# Projects (Updated)

August 23, 2003
No Comments.

Everytime I add a app.config file to a new C# App, it never does what I want. I want the app.config file to be deployed to the build directory so I can make changes to the app.config file and have it propogated. With the release of VS.NET 2003, us C# developers now have pre and post build steps. So I now have to remember to add the following to the post-build event:


xcopy /s $(ProjectDir)app.config $(TargetPath).config

I know I could write an “Add New Item” to make it happen, but I just haven’t had the time. I just wish MS had done it for me.

UPDATE

Chris Sells has alerted me to the fact that if your project has a app.config file, VS.NET 200X will copy it and rename it for you. My bad. I could have sworn that I tried this before and it didn’t work : (