【问题标题】:is it possible to ignore assembly manifest mismatch?是否可以忽略程序集清单不匹配?
【发布时间】:2016-08-16 16:30:54
【问题描述】:

我正在尝试在我的 asp.net 网站中使用我使用 NuGet 引入的几个库。

问题是我收到此错误:

Could not load file or assembly 'AWSSDK, Version=1.5.9.1, Culture=neutral, PublicKeyToken=cd2d24cd2bace800' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我尝试使用的库之一需要使用 AWSSDK,但显然它正在寻找我无法再获得的旧版本。

是否可以忽略此错误?

这是一个全新的网站,还没有代码,只是NuGet拉进来的,web.config是空的。

编辑:

我添加了 Fusion 日志记录,现在我得到:

=== Pre-bind state information ===
LOG: User = WIN-FSSH1EIG4NE\Max
LOG: DisplayName = AWSSDK, Version=1.5.9.1, Culture=neutral, PublicKeyToken=cd2d24cd2bace800
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Max/Documents/Visual Studio 2010/WebSites/images.RepZio/
LOG: Initial PrivatePath = C:\Users\Max\Documents\Visual Studio 2010\WebSites\images.RepZio\bin
Calling assembly : ImageResizer.Plugins.S3Reader, Version=3.3.2.447, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Max\Documents\Visual Studio 2010\WebSites\images\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: AWSSDK, Version=1.5.9.1, Culture=neutral, PublicKeyToken=cd2d24cd2bace800
LOG: Attempting download of new URL file:///C:/Users/Max/AppData/Local/Temp/Temporary ASP.NET Files/root/8dcd52e9/53da58e/AWSSDK.DLL.
LOG: Attempting download of new URL file:///C:/Users/Max/AppData/Local/Temp/Temporary ASP.NET Files/root/8dcd52e9/53da58e/AWSSDK/AWSSDK.DLL.
LOG: Attempting download of new URL file:///C:/Users/Max/Documents/Visual Studio 2010/WebSites/images/bin/AWSSDK.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

如果我像下面评论中提到的那样添加 bindingRedirect,我会得到同样的错误。

【问题讨论】:

  • 查看web.config中的bindingRedirect
  • 发生同样的错误,我启用了日志记录,现在我在 EDIT 下得到了上述内容
  • 显示您在 web.config 中所做的条目。

标签: c# asp.net


【解决方案1】:

最新的 (1.5.13.0) AWSSDK 版本似乎使用与以前版本不同的密钥进行签名。所以不幸的是,bindingRedirect 不起作用。

按以下步骤进行:

打开包管理器控制台(工具 > 库包管理器 > 包管理器控制台)并输入:

PM> Uninstall-Package -Force AWSSDK

接着是:

PM> Install-Package AWSSDK -Version 1.5.12.1

然后仔细检查您的 web.config 文件。确保它仅包含 AWSSDK 的以下绑定重定向:

<dependentAssembly>
    <assemblyIdentity name="AWSSDK" publicKeyToken="cd2d24cd2bace800" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.5.12.1" newVersion="1.5.12.1" />
</dependentAssembly>

现在,您的项目应该可以开始了。

【讨论】:

    【解决方案2】:

    尝试编辑 .csproj 文件并从引用程序集 awssdk 的行中删除 Version=1.5.9.1。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      相关资源
      最近更新 更多