System.Windows.Interactivity - 加载程序集时出现异常

时间:2013-12-09 18:31:21

标签: c# .net wpf .net-assembly blend

在我的WPF应用程序中添加了一些对View的新引用后,我得到了一个例外:

{"Could not load file or assembly 'System.Windows.Interactivity, Version=3.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)"}

堆栈跟踪:

at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MyApplication.GUI.MyPage.InitializeComponent() in c:\Users\Dl\Documents\Visual Studio 2012\Projects\MyApplication\MyApplication.GUI\MyPage.xaml:line 1
at MyApplication.GUI.MyPage..ctor(SettingsViewModel settingsViewModel) in c:\Users\Dl\Documents\Visual Studio 2012\Projects\MyApplication\MyApplication.GUI\MyPage.xaml.cs:line 13 

这是导致异常的代码:

<i:Interaction.Triggers>
    <si:DataEventTrigger EventName="MyEvent">
        <ei:ControlStoryboardAction Storyboard="{StaticResource MyStoryboard}" 
               ControlStoryboardOption="Play"/>
    </si:DataEventTrigger>
</i:Interaction.Triggers>

我添加的参考文献:

Microsoft.Expression.Interactions (ver. 4.5)
System.Windows.Interactivity (ver. 4.5)
Expression.Samples.Interactivity (ver. 1.0.0.0)

我不知道System.Windows.Interactivity 3.5依赖来自何处。你能给我一个线索吗?

顺便说一句:This可能会澄清我的意图。

1 个答案:

答案 0 :(得分:2)

解决方案是引用由blend而不是.NET Framework 4.5提供的程序集。

谢谢你的帮助。你把我放在合适的卡车上。