7

I am trying to reference System.Windows.Interactivity in order to support IsExpanded behavior command

But as soon as i add a reference to this assembly, i get the error loading System.Windows 2.0. This appears to be a known bug, and solution appears to be to just reference that assembly.

I downloaded Silverlight SDK, and referenced assembly in question in my project.

however, now i am getting lots of conflicts between System.Windows, and WindowsBase.dll. Classes such as RoutedEventHandler exist in both.. Must be a way to fix this, since i see people being successful in using that Interactivity dll with wpf 4.0..

Community
  • 1
  • 1
Sonic Soul
  • 23,855
  • 37
  • 130
  • 196

5 Answers5

14

If you have a WPF project you need to use the WPF specific version of that assembly, maybe you took the wrong .dll?

Here are the two respective file paths on my system:

C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries\System.Windows.Interactivity.dll
C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries\System.Windows.Interactivity.dll
H.B.
  • 166,899
  • 29
  • 327
  • 400
  • my Expression dir only has /Silverlight in it.. so i took the Interactivity.dll from there. System.Windows was not there at all, so i got that by installing silverlight sdk, and then get it from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0 – Sonic Soul Sep 25 '11 at 22:36
  • @SonicSoul: You **cannot** use Silverlight libraries in WPF don't even try. If the WPF assembly is not there then reinstall the [Blend SDK](http://www.microsoft.com/downloads/en/details.aspx?FamilyID=f1ae9a30-4928-411d-970b-e682ab179e17&displaylang=en) and make sure that the WPF components will be installed. – H.B. Sep 25 '11 at 22:38
  • i got System.Windows.Interactivity.dll from C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries – Sonic Soul Sep 25 '11 at 22:42
  • 1
    @SonicSoul: As i said, that is for Silverlight, it **cannot** be used in WPF – H.B. Sep 25 '11 at 22:43
  • where else could i get System.Windows.Interactivity? – Sonic Soul Sep 25 '11 at 22:44
  • @SonicSoul: Also as i said, reinstall the Blend SDK (link in recent comment) and see if you can get it to install the WPF component. – H.B. Sep 25 '11 at 22:45
  • @SonicSoul: Newer version [here](http://www.microsoft.com/download/en/details.aspx?id=10801)... – H.B. Sep 25 '11 at 22:54
  • thanks! sorry i responded before seeing all of your comments. i'll give that a try – Sonic Soul Sep 25 '11 at 23:06
2

You need to reference the dll's in the main project (not just the control libraries). It was the problem in my case. See more info here: Could not load file or assembly 'System.Windows.Interactivity'

Community
  • 1
  • 1
Eternal21
  • 4,190
  • 2
  • 48
  • 63
2

I got this error when running a project built in a previous version of Visual Studio, but I was running it in VS2017.

My issue was resolved by opening the VS2017 installer and modifying my install to select the "Blend for Visual Studio SDK for .Net" component in the VS 2017 install.

Screenshot of VS2017 installer window showing component to select

Fissh

gadildafissh
  • 2,243
  • 1
  • 21
  • 26
1

If one of your projects is targeting the .NET 4.0 Client Profile you might find switching to the full .NET 4.0 framework corrects the issue.

mbursill
  • 2,911
  • 1
  • 32
  • 44
0

Sonic, like H.B. said you can't use Silverlight version in WPF. You will need to install different WPF specific Expression Blend SDK instead of Silverlight.

Vlad Bezden
  • 83,883
  • 25
  • 248
  • 179