Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

wpf

mef

prism

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.

like image 315
Guy P Avatar asked Mar 10 '14 15:03

Guy P


2 Answers

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

like image 90
Rashad Valliyengal Avatar answered Oct 03 '22 20:10

Rashad Valliyengal


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.

like image 43
Guy P Avatar answered Oct 03 '22 20:10

Guy P