Wednesday, September 28, 2005

NUnit and ConnectionStrings

Thanks to one of my co-workers I stumbled across how to get NUnit working with externally hosted App.config files in .NET 2.0 and VS 2005. I wrote test harnesses in NUnit for all the database classes I had developed. The connectionString was stored in the App.config file. Once I figured out that I needed the name of the config file to be the same as the “[appname].dll.config” stored in the “bin/Debug” directory then the NUnit tests worked. Then came the issue of deployment. We have a build server that uses cruisecontrol.net to manage our build and I needed to get the “[appname].dll.config” to be redeployed from my sandbox computer onto the build server. But how to deploy a file targeted for the “bin/Debug” folder. Nice thing about Visual Studio is you can set the property on the file so it gets copied from your project directory to the build server. Nice…