同一文件的 .NET DLL 依赖项 [英] .NET DLL dependency of same file

查看:31
本文介绍了同一文件的 .NET DLL 依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我升级了我们的一个网站,并因这个错误而感到震惊:

I upgraded one of our websites and were greated by this error:

=== Pre-bind state information ===
LOG: User = NT AUTHORITYNETWORK SERVICE
LOG: DisplayName = <assembly>, Version=2.0.42.64, Culture=neutral, PublicKeyToken=c445f6f924945bd1
(Fully-specified)
LOG: Appbase = file:///E:/Web/
LOG: Initial PrivatePath = E:Webin
Calling assembly : <assembly>, Version=2.0.42.67, Culture=neutral, PublicKeyToken=c445f6f924945bd1.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:Webweb.config
LOG: Using host configuration file: C:WindowsMicrosoft.NETFrameworkv2.0.50727Aspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv2.0.50727configmachine.config.
LOG: Post-policy reference: <assembly>, Version=2.0.42.64, Culture=neutral, PublicKeyToken=c445f6f924945bd1
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/5ee48cb7/31fcfc81/<assembly>.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/5ee48cb7/31fcfc81/<assembly>/<assembly>.DLL.
LOG: Attempting download of new URL file:///E:/Web/bin/<assembly>.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

其中 是汇编的名称.

Where <assembly> is the name of the assemble.

如果我没看错, assemble(.67) 正在尝试加载自己,但是以前的 (.64) 失败了,因为显然一个文件不能有 2 个版本...

If i read this correctly the assemble(.67) is trying to load itself, but the previous(.64) and is failing because the obviously a file can't have 2 versions...

什么会导致这个问题?是我的配置有问题还是程序集的编译有问题?

What can cause this problem? Is it my configuration or the assembly's compilation that is wrong?

推荐答案

我现在找到了错误消息的原因并将其张贴在这里,以便它可以帮助其他人.

I've found the reason for the error message now and posting it here so it might help others.

有两个程序集具有循环依赖,其中之一没有严格的修订检查:

There were two assemblies with cyclic dependency, where one of them didn't have strict revision check:

a1(.67) -> a2(.11) -> a1(.64)

其中a1a2 是程序集名称,括号中的数字是修订版.

Where a1 and a2 are the assembly names and the number in the brackets are the revisions.

所以真正发生的是第一个程序集正在加载一个旧的程序集,而它又试图加载一个程序集的旧版本.然后错误消息会告诉您 a1(.67) 尝试加载 a1(.64),并跳过整个加载程序集链.

So what really happens is that the first assembly is loading an old assembly, which in turn tries to load the old revision of assembly one. Then the error message will tell you that a1(.67) tries to load a1(.64), and skips the whole chain of loading assemblies.

为了帮助调试这个 a1 应该严格规定应该加载什么版本的 a2.然后错误信息会告诉你 a2 是旧的.

To help with debugging of this a1 should be strict about what revision of a2 that should be loaded. Then the error message will tell you that a2 is old.

这篇关于同一文件的 .NET DLL 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆