app.config files for DLLs

Posted on Wednesday, May 18, 2005 in Uncategorized

In one of my work projects I’ve made heavy use of unit tests, and in particular the integration of TestDriven.NET and Visual Studio .NET.

I keep all my tests in a separate assembly, but I need to make use of varying connections strings. The most obvious solution was to use an configuration key in an app.config file attached to the test project, but the projects was set to output a library (DLL), and VS.NET doesn’t automatically handle app.config files for libraries.

Now I could just create the file in my output directory and have it work, but a) that’s not very neat and b) being the good SCM user I am I don’t store build artifacts in subversion.

After a bit of a google, the most obvious solution was to use a Post-build Event to copy and rename the file for me like VS.NET should.

Here’s my variation of the solution:

copy "$(ProjectDir)app.config" "$(TargetDir)$(TargetFileName).config"

Related posts:

The joy of text Really the title should be “the joy of UNIX”, but... How to ASP.NET without using web projects Web projects in Visual Studio .NET can be be a... Useful subversion bash functions Inspired by bbum’s Useful subversion shell aliases I decided to... Using HttpHandlers with mod_mono Mike Roberts’ post about disposing with Web Forms piqued my... Gregarius under LightTPD and FastCGI Not one to hang around, I decided to give Gregarius...

Related posts brought to you by Yet Another Related Posts Plugin.


Mobilized by Mowser Mowser
Mobilytics