显示名称为 'System.Windows.Interactivity' 的程序集加载失败
The assembly with display name 'System.Windows.Interactivity' failed to load
我致力于解决我有多个 WPF 项目的问题。我使用 MVVM 架构,我有一个主应用程序,它从同一解决方案中的其他项目继承用户控件。主应用程序是一个简单的 wpf 应用程序项目,另一个是 class 库。我在 class 库用户控件的初始化组件上收到此错误。该用户控件需要此程序集。我该如何解决这个 problem/error?谁能帮我?谢谢。
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>
在我看来,您使用的 DLL 版本有误。该 DLL 有许多不同的版本。您需要适用于您的 .NET 版本的那个。您指的是 4.5 版本吗?
我致力于解决我有多个 WPF 项目的问题。我使用 MVVM 架构,我有一个主应用程序,它从同一解决方案中的其他项目继承用户控件。主应用程序是一个简单的 wpf 应用程序项目,另一个是 class 库。我在 class 库用户控件的初始化组件上收到此错误。该用户控件需要此程序集。我该如何解决这个 problem/error?谁能帮我?谢谢。
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>
在我看来,您使用的 DLL 版本有误。该 DLL 有许多不同的版本。您需要适用于您的 .NET 版本的那个。您指的是 4.5 版本吗?