
A minor annoyance with Visual Studio, is that it doesn’t allow you to include conditional references to Debug and Release versions of class libraries. For example, if you have a project and you add a reference to a class library by right-clicking on the ‘Reference’ folder and selecting the ‘Add Reference…’ menu item, the version of the library that you choose, be it Debug or Release, will always be used regardless of whether you choose to build a Debug or Release version of your project.
There is a way around this. First, add your reference to the class library using Visual Studio as you normally would. Next, close your project and open your project file (*.csproj) using the source code editor. Find the location of the reference you just added and replace the ‘Debug’ or ‘Release’ portion of the string with ‘$(Configuration)’.
Code after the break…
Read more

