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!

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.