确定对 mscorlib 的项目引用

发布于 2024-08-18 06:12:01 字数 295 浏览 3 评论 0原文

大家好,我有一个 ASP.NET 网站项目,由于某种原因,该项目坚持引用 mscorlib 1.0.5 和 mscorlib 2.0,但我不明白为什么。

我已经使用 NDepend 分析了所有引用的 DLL,它们似乎都只引用了 mscorlib 2.0。我有几个网络引用,但我无法想象为什么这会创建对 1.0 dll 的附加引用。

任何人都知道为什么我会得到这个额外的参考,或者我可以用什么来找出这些信息? NDepend 很棒,但只是回来说“找到了 2 个参考文献,使用较新的版本”,所以它不能帮助我弄清楚为什么我有额外的参考文献......

Hey folks, I've got an ASP.NET web site project that for some reason is insisting on referencing both mscorlib 1.0.5 and mscorlib 2.0, and I can't figure out why.

I've analyzed all the referenced DLLs using NDepend, and they all appear to only reference mscorlib 2.0. I've got a couple web references, but I can't imagine why that would create an additional reference to the 1.0 dll.

Anyone have any ideas why I'd be getting this additional reference, or what I can use to find out that information? NDepend is great, but just comes back and says "found 2 references, using the newer version", so it doesn't help me figure out why I have the extra reference...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愁杀 2024-08-25 06:12:01

我认为此时你最好的选择是使用 ildasm。在程序集上使用 ildasm 将显示一个名为“Manifest”的节点。双击该节点,它将转储出程序集引用的 IL 表示形式,包括引用的版本号。对所有 DLL 重复此操作,直到找到引用 1.0 版本的 DLL。

编辑

另一种可能的解决方案是枚举 Assembly 值以及关联的 GetReferencedAssemblies 方法。这将返回一个包含相应 Version 成员的 AssemblyName 值数组。这应该包含引用程序集的实际版本与实际加载的版本。

我对这个问题不是 100% 确定,而且现在没有方便的方法来测试它。

I think at this point your best bet is to use ildasm. Using ildasm on the assembly will bring up a node named "Manifest". Double click on that node and it will dump out the IL representation of assembly references including the referenced version number. Repeat this for all of your DLL's until you find the one referencing the 1.0 version.

EDIT

Another possible solution would be to enumerate the Assembly values and there associated GetReferencedAssemblies method. This will return an array of AssemblyName values which have a corresponding Version member. This should contain the actual version of the referenced assembly vs. the one that was actually loaded.

I'm not 100% sure on this matter and don't have a convenient way to test it right now.

抠脚大汉 2024-08-25 06:12:01

尝试删除引用并重新编译 - 这将告诉您什么(如果有的话)取决于旧版本。

Try removing the reference and recompiling - that will tell you what (if anything) depends on the older version.

左岸枫 2024-08-25 06:12:01

您的 web.config 文件中可能存在错误的引用。

An errant reference may be residing in your web.config file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文