21

Does anybody know if it is possible, and if so how to link to one set of DLL's in a debug build and a different set of DLL's in a release build on a C# Project using Visual Studio 2008?

rene
  • 41,474
  • 78
  • 114
  • 152
DukeOfMarmalade
  • 2,680
  • 10
  • 41
  • 70
  • By the way, the DLL's are not built as part of my soloution. – DukeOfMarmalade Feb 10 '12 at 12:23
  • A little late, but google never forgets, so in this thread the question already has been answered: http://stackoverflow.com/questions/5491253/visual-studio-2010-compiling-with-the-debug-or-release-version-of-third-party-li – joergipoergi Oct 09 '12 at 13:46

2 Answers2

33

If you Unload the project file (context menu of the project) and then edit it, add a condition on the itemgroup for each build configuration holding the references:

<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL" />
    <Reference Include="Elmah, Version=1.2.13605.0, Culture=neutral, processorArchitecture=MSIL" />
</ItemGroup>

After saving your changes, you can Reload the project from the context menu of the project file.

rene
  • 41,474
  • 78
  • 114
  • 152
5

I don't think this can be done with default means of Visual Studio. One thing I could think of is to create some sort of "debug flag" and load the DLLs dynamically depending on that flag.

Thorsten Dittmar
  • 55,956
  • 8
  • 91
  • 139