DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

ClassLibrary Projects And App.config

07.17.2006
| 4200 views |
  • submit to reddit
        This snippet comes from Jamie Cansdale at TestDriven.net (http://weblogs.asp.net/nunitaddin/archive/2006/06/07/ClassLibrary-Projects-and-App.config.aspx)

In Visual Studio .NET 2003 if you want you unit tests to use an app config file you need to ensure a config file exists with the same path as your test assembly but ending with '.config'. Life has improved a bit with Visual Studio 2005 as it will automatically copy any 'App.config' file to the correct place even for ClassLibrary projects. You can achieve the same affect in VS2003 by using the following post-build event:
copy "$(ProjectDir)App.config" "$(TargetPath).config"