由于间接依赖于不同的框架版本,MVC3 项目无法构建



自从我安装.NET 4.6.2以来,用来在我的系统上构建良好的项目(MVC3 .NET 4.0)已停止工作。(这是在Windows 10上,带有VS2017 Pro)。我发现了一堆构建错误,因为我无法找到类型,如果我在错误列表中单击以跳到文件位置,语法突出显示显示一切都很好。但是,我得到一些警告,我认为我认为是读取类似内容的错误的实际来源

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具有引起了这个。

update

所以我通过它是一个好主意,可以安装骑手,并且存在相同的问题。登录诊断视图,它指出该项目是为构建工具4.0版配置的,只有15个可用。我将尝试下载MSBUILD工具,看看是否有帮助

我认为您的主要问题不是.NET版本,而是迁移到较新版本的MVC(本文中的类似问题)。VS 2017不支持MVC 3,您需要正确遵循此处提到的迁移步骤。我认为同一组件的不同版本是由于迁移到MVC 5的错误而导致的。

最新更新