kaan_93
kaan_93

Reputation: 85

The assembly with display name 'System.Windows.Interactivity' failed to load

I work on solution where I have more than one WPF projects. I use the MVVM architecture, and I have a main app which inherit User Controls from another projects in the same solution. The main app is a simple wpf application project and the other is class libraries. I got this error on Initialization Component from the class library user control. That user control needs this assamblies. How can I solve this problem/error? Can anyone help me? Thank you.

Additional information: The assembly with display name 'System.Windows.Interactivity' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileLoadException: Could not load file or assembly 'System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    this is the structure:
          MainProject
            ->Model
            ->ViewModel
            ->DLL
              ->System.Windows.Interactivity.dll(I use this reference)
            ->View
              ->ClassLibraryView.xaml
              code:
        <Window x:Class="MainProject.Views.ClassLibraryView"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:userControl="clr-namespace:ClassLibrary.View;assembly=ClassLibrary"              
                Title="main" Height="500" Width="800" MinWidth="600" MinHeight="400">

            <Grid>
                <userControl:ClassLibraryUserControl/>
            </Grid>

        </Controls:MetroWindow>

-------------------------
    ClassLibrary
     ->Model
     ->ViewModel
     ->View
        ->ClassLibraryUserControl.xaml
        code:
<UserControl x:Class="ClassLibrary.View.ClassLibraryUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:b="clr-namespace:ClassLibrary.Behavior"
             xmlns:u="clr-namespace:ClassLibrary.Utility"
             mc:Ignorable="d" 
             d:DesignHeight="350" d:DesignWidth="525">
    <Grid>
           ...
    </Grid>
</UserControl>

Upvotes: 1

Views: 2571

Answers (1)

SledgeHammer
SledgeHammer

Reputation: 7726

Looks to me like you are using the wrong version of the DLL. That DLL has a bunch of different versions floating around. You need the one for your version of .NET. Are you referencing the 4.5 version?

Upvotes: 1

Related Questions