views:

46

answers:

2

I have the SL Control toolkit installed on my machine and I have added a reference to the toolkit DLL (System.Windows.Controls.Toolkit.dll)

I like to have all my external dependencies in a lib folder under the SL project, so I copied over the DLL from the installation dir of the control toolkit to the lib folder, but if I try to add reference to the DLL from this location, VS is still picking up the reference from the installation dir.

What gives?

+2  A: 

The installed DLLs are always searched first, even if you add the DLL by browsing. The path in the properties window (for your added reference) would have shown the "installed" version instead immediately after adding the reference to your copy.

A build machine would not have the toolkit installed. You could uninstall the toolkit and organise the DLLs yourself if you really need that sort of behaviour.

Enough already
I was afraid of this, not sure why this is the default behavior and it seems unfortunate that VS is working against you instead of for you!
Abhijeet Patel
+1  A: 

I ran across this problem everyday. The easy (it feels that way after some time) solution is to unload the project (right click>Unload Project) then right click again en select Edit. Find a reference that is point to another assembly in your lib folder, copy that Xml element and change the 'Hint' path to your assembly.

It will look something like:

<ItemGroup>
    <Reference Include="Ninject">
      <HintPath>..\..\Ninject.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <!-- other references removed for breviti-->
  </ItemGroup>
Miguel Madero
Darn! I hate hacks but looks like I don't have a choice
Abhijeet Patel