【发布时间】:2017-09-04 16:40:33
【问题描述】:
自从我安装 .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 工具,看看是否有帮助
【问题讨论】:
-
所以最终结果证明,一些项目设置在 .net 4.5 中构建,这让整个团队感到惊讶。将它们全部更新到 net45 解决了这个问题。奇怪的是,在 OSX 上运行的骑手在这种配置下一点问题都没有
标签: .net asp.net-mvc-3 .net-4.0 .net-4.6