自从我安装.net 4.6.2以来,用于在我的系统上构建正常的项目(MVC3 .net 4.0)已停止工作。 (这是在带有VS2017 Pro的Windows 10上)。我得到一堆关于无法找到类型的构建错误,如果我在错误列表中单击以跳转到文件位置,语法突出显示一切都很好。 然而,我得到一些警告,我认为这是错误的实际来源,读取类似这样的
The primary reference "....Services.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "...Services.dll" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
然后我有第二个警告,看起来像这样
The primary reference "...Services.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=2.6.9.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "...Services.dll" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=2.6.9.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
我很困惑为什么对同一个程序集的不同版本有两个不同的引用,但是比以往更加困惑为什么它无法构建以及这些警告告诉了什么以及为什么要安装最新版本的。 NET造成了这种情况。
更新
所以我通过它安装Rider是一个好主意,它也有同样的问题。在其诊断视图中记录它指出该项目是为构建工具4.0版配置的,只有15可用。我将尝试下载MSbuild工具,看看是否有帮助