Search code examples
c#wpfprismmef

`Could not load file or assembly 'Microsoft.Windows.Shell` , Prism - C#


I'm trying to run PRISM (MEF) example project, but get this error:

Managed Debugging Assistant 'BindingFailure' has detected a problem in 'Prism4MefDemo.vshost.exe'.

Additional information: The assembly with display name 'Microsoft.Windows.Shell' 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 'Microsoft.Windows.Shell, Version=3.5.41019.1, 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)

I've tried to remove and manualy add reference to Microsoft.Windows.Shell but still nothing.

The version of this DLL is 3.0.1.0, and not 3.5.41019.1 as in the Exception.

This is the line with the Excecption:

    protected override DependencyObject CreateShell()
    {
        return this.Container.GetExportedValue<ShellWindow>();
    }

How can I fix it? Thanks.


Solution

  • So after trying everything, I looked for others files in my computer (Microsoft.Windows.Shell.dll) and found newer version, as expected by the Exception (3.5.41019.1) in MicrosoftRibbon for WPF\V3.5 folder.

    It is strang,because the latest version of the NuGet package is 3.0.1.

    Thanks anyway.