# Monday, June 25, 2007
« New Computer Joy | Main | Vista Will Not Sleep With Wireless Keybo... »
I wanted my external file based assembly references to behave like my project references when switching between debug and release configuration.  According to this very good Managing Dependencies document from Microsoft, you should always reference the release version of an external assembly and then use the "Reference Paths" in the project properties to override that setting to the debug folder if need be.  That sounded like extra work in the long run, and to be honest I would probably forget to do that until after I started my debug session.  Here's what I ended up doing to make Visual Studio automatically switch between release and debug versions of my external referenced assemblies:

  1. All my build output for all projects are setup to be copied to <working path>\build\<configuration>.  So when building a release build, that path is really d:\source\build\release.
  2. Add a reference to the release or debug version of the external file based assembly located in the directory mentioned in step 1.
  3. Unload the .csproj file from within Visual Studio that has the reference to the external assembly.
  4. Edit the unloaded project file and change the HintPath from ..\..\build\release\commons.dll to ..\..\build\$(Configuration)\commons.dll.
  5. Save, then reload the project.
Now you can use the built-in Visual Studio configuration manager to switch between debug and release external assemblies just like you can with project references.  Yeah!  Once less thing for me to mess up.

Comments are closed.