System.Windows.Interactivity: Could not load file or assembly 'System.Windows, Version=2.0.5.0

31,846

Solution 1

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

Solution 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'

Solution 3

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

Solution 4

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.

Share:
31,846
Sonic Soul
Author by

Sonic Soul

Updated on July 09, 2022

Comments

  • Sonic Soul
    Sonic Soul almost 2 years

    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..

  • Sonic Soul
    Sonic Soul over 12 years
    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
  • H.B.
    H.B. over 12 years
    @SonicSoul: You cannot use Silverlight libraries in WPF don't even try. If the WPF assembly is not there then reinstall the Blend SDK and make sure that the WPF components will be installed.
  • Sonic Soul
    Sonic Soul over 12 years
    i got System.Windows.Interactivity.dll from C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries
  • H.B.
    H.B. over 12 years
    @SonicSoul: As i said, that is for Silverlight, it cannot be used in WPF
  • Sonic Soul
    Sonic Soul over 12 years
    where else could i get System.Windows.Interactivity?
  • H.B.
    H.B. over 12 years
    @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.
    H.B. over 12 years
    @SonicSoul: Newer version here...
  • Sonic Soul
    Sonic Soul over 12 years
    thanks! sorry i responded before seeing all of your comments. i'll give that a try