Could not load file or assembly Microsoft.Expressi

2019-06-26 11:15发布

问题:

I am facing unknown problem while using Prism 4. We implement business solution in MVVM pattern. For that I have used

 1. Microsoft.Expression.Interactions

 2. System.Windows.Interactivity

 3. GalaSoft.MvvmLight.Extras.WPF4

for Interaction.Triggers, CallMethodAction and EventToCommand.

<SWI:Interaction.Triggers>
    <SWI:EventTrigger SourceObject="{Binding ElementName=txtName}" EventName="GotFocus">
        <MEI:CallMethodAction TargetObject="{Binding Path=DataContext,ElementName=txtName}" MethodName="txtName_GotFocus"></MEI:CallMethodAction>
    </SWI:EventTrigger>
    <SWI:EventTrigger SourceObject="{Binding ElementName=txtName}" EventName="KeyUp">
        <GMEWCMD:EventToCommand   Command="{Binding Path=DataContext.cmdtxtNameKeyUpEvent,ElementName=txtName}" PassEventArgsToCommand="True">
        </GMEWCMD:EventToCommand>
    </SWI:EventTrigger>
</SWI:Interaction.Triggers>

Everything is working fine but now we required to make whole system loosely couple we choose prism 4. We already achieved this but above code create following problem as below.

Could not load file or assembly 'Microsoft.Expression.Interactions, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

If I comment above code everything is working fine. I don't know what an issue. Does PRISM 4 not support above assemblies?

Please help us to get rid from this problem.

Thank you

回答1:

This commonly happens to me when I reference both Microsoft.Expression.Interactions and System.Windows.Interactivity in a view that belongs to a module, but I fail to also add those references to the project that acts as the shell.



回答2:

I had a similar problem with Prism in Visual Studio 2012. The XAML editor would fail with the same exception.

The solution was to install Microsoft Expression Blend SDK. The assembly should be part of SDK. Allegedly, it is necessary for binding between control events and commands in XAML and some code may require it.



回答3:

I had the same problem during a Prism 6.1 composite app using .NET 4.5.2, where i was referencing in one of the modules (class library) the Microsoft.Expression.Interactions & System.Windows.Interactivity. Eventually i had to reference the same dlls in the Desktop project (where bootstrapper and Shell belong)