首页 > 解决方案 > MSB3258:mscorlib 4.0.0.0 和 2.0.0.0

问题描述

所以我试图在 VS 2017 上编译一个项目,我得到了这个:

 warning MSB3258: The primary reference "someLib.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

之后,我遇到与此 dll 相关的错误(例如,类型或名称空间不在名称空间中),但是当我双击该错误时,它会消失,以及代码中的红色波浪线,暗示事实是这不是实际问题。

我尝试过的一切都不起作用:所有项目都在 3.5 上,我删除并重新添加了所有引用,除了我自己的计算机之外,它不会发生在任何其他计算机上。我还尝试从 GAC 中删除 mscorlib(尽管这可能很愚蠢),但它当然不会让我这样做。

我看到了一些可能相关的东西: https ://developercommunity.visualstudio.com/content/problem/230636/assemblydependency-now-misidentifying-indirect-dep.html

除了删除和重新安装 VS,不知道该怎么做。如果有人有任何想法,我很乐意尝试。

标签: c#dllvisual-studio-2017mscorlib

解决方案


这是对一个名为“Shell32.dll”的 Interop.Shell32.dll 版本的奇怪引用。不知道从哪里来的。

如果其他人有这个问题:一次删除每个依赖项并编译。甚至微软的。


推荐阅读