Categories
Etc

Using post-build events to make your own app.config

Often times, I have my own configuration files outside of the standard configuration framework (web.config / my.assembly.exe.config, etc).  When I’m developing a WinForm or Console app in VS.NET, I need to get a standard config file into the $(TargetDir) directory so my app will pick it up under testing.  VS.NET does this magic for you if you have an app.config file in the root of your project.  On build, it will be copied to $(TargetDir) and renamed appropriately.  Well, you can do the same thing with a PostBuild event.  Here’s a sample of one I use:

copy $(ProjectDir)MySuperSpecial.config $(TargetDir)MySuperSpecial.config

Very handy and it even works with the <solution/> task in NAnt!

Advertisements