首页 > 解决方案 > mscorlib 上的警告 MSB3258 以供共享参考

问题描述

因此,我目前正在开发一个 .NET Framework 项目,该项目引用由我正在使用的另一个开发人员制作的 DLL,我将其称为“random.dll”。我的项目的目标是 .NET 3.5。我的项目中没有编译器错误,但是当我在引用此 DLL 时尝试构建时,我在构建期间收到警告,指出无法解析引用:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3258: The primary reference "random.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.

在尝试引用该引用中的类时,此构建警告会导致我的构建失败。

然后我压缩了我的项目并将其发送给开发人员,他们能够在不更改项目的情况下自行构建它。我试图弄清楚只有在我的机器上可能会导致此问题的不同之处。

标签: c#dllvisual-studio-2019mscorlib

解决方案


将您的 .net 框架更改为 4.0.0


推荐阅读