gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 18:05:54 26 4
gpt4 key购买 nike

我正在尝试运行 PRISM (MEF) 示例项目,但出现此错误:

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)

我已经尝试删除并手动添加对 Microsoft.Windows.Shell 的引用,但仍然没有。

此 DLL 的版本是 3.0.1.0,而不是异常中的 3.5.41019.1

这是带有异常的行:

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

我该如何解决?谢谢。

最佳答案

最后,我通过安装来自 hereMultilingual App Toolkit 解决了这个问题。并从 "C:\Program Files (x86)\Multilingual App Toolkit" 位置添加对“Microsoft.Windows.Shell.dll”的引用,或将 dll 复制到您的私有(private)程序集文件夹并引用它。

当您从 Nuget 安装 Microsoft.Windows.Shell.dll 时,它正在安装 v3.0.1,但实际预期的版本是 v3.5.41019.1。您将从上述路径获得这个新版本。

谢谢

关于c# - `Could not load file or assembly ' Microsoft.Windows.Shell`, Prism - C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22304193/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com