0

I have created a custom control which requires visual state management. As there is no support for VisualStateManager in .Net 3.5 framework. So I am using WPFToolkit v3.5.40619.1 internally in order to make use of VisualStateManager in my control project.

Now if I use that custom control in a separate project by adding reference to it, I have to add reference to WPFToolkit.dll also because my control uses it internally. But if I add a different version of WPFToolkit i.e. 3.5.40128.4 which is different than the one used in my custom control, it throws exception "Could not load file or assembly 'WPFToolkit, Version=3.5.40128.4, Culture=neutral, PublicKeyToken=51f5d93763bdb58e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Error at object 'System.Windows.Controls.ControlTemplate'".

There is no problem if I use the same WPFToolkit v3.5.40619.1 which is used in my custom control internally.

Can anybody please tell me how can I solve this problem?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
  • I am having the same issue. It seems that Specific Version = false doesn't work for dll reference of WPF apps. Any update on this? – Rushui Guan Feb 07 '14 at 17:07

1 Answers1

0

Right click on the reference in the solution explorer => properties. Set False to Specific version. It will search for any reference with the same short name

Kek
  • 3,145
  • 2
  • 20
  • 26
  • It is set to false in both projects (custom control & calling project) ? How are you referencing it ? using a downloaded dll ? I mean, you did not compile it yourself? – Kek Jul 03 '12 at 11:26
  • I compiled my custom control dll myself. This custom control is referencing WPFToolkit.dll internally. Now once I add reference to my custom control dll in a separate application, I have to add reference to WPFToolkit also. But if this WPFToolkit version is different than the one used at compile time (for custom control), it throws exception. – user919022 Jul 03 '12 at 11:35
  • Weird... nothing in the GAC? There may be a solution which consist of setting Specific version to true and either setting the dll in the GAC or embed it in the assembly; see http://stackoverflow.com/questions/222655/embedding-assemblies-inside-another-assembly – Kek Jul 03 '12 at 11:51