是否可以忽略汇编清单不匹配?

时间:2013-02-17 12:55:43

标签: c# asp.net

我正在尝试使用我在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,我会得到同样的错误。

2 个答案:

答案 0 :(得分:7)

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

请按以下步骤操作:

打开包管理器控制台(Tools> Library Package Manager> Package Manager Console)并输入:

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>

现在,您的项目应该很好。

答案 1 :(得分:0)

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

相关问题