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

10

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.

c#
wpf
prism
mef
asked on Stack Overflow Mar 10, 2014 by Guy P

4 Answers

18

Finally I solved this issue by installing Multilingual App Toolkit from here and Add Reference to "Microsoft.Windows.Shell.dll" from the location "C:\Program Files (x86)\Multilingual App Toolkit" or copy the dll to your private assembly folder and refer it.

When you install Microsoft.Windows.Shell.dll from Nuget, it was installing v3.0.1, But the actual expected version was v3.5.41019.1. you ll get this new version from the above path.

Thanks

answered on Stack Overflow Mar 2, 2015 by Rashad Valliyengal • edited Oct 10, 2015 by Rashad Valliyengal
7

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.

answered on Stack Overflow Mar 11, 2014 by Guy P
0

Adding Microsoft.Windows.Shell.dll v3.5.41019.1 to your project references, would solve the problem.

answered on Stack Overflow Aug 22, 2014 by marcusvmg • edited Aug 6, 2015 by Glen Thomas
0

We had this problem when using the Ribbon control.

The solution was remove the ribbon: prefix from the very start of the XAML and use the default ribbon control, not the one that utilizes a namespace.

answered on Stack Overflow Jul 28, 2020 by Jon Barker

User contributions licensed under CC BY-SA 3.0