主参考无法得到解决,因为它是建立对.NET框架比当前目标框架的更高版本 [英] The primary reference could not be resolved because it was built against a higher version of the .NET framework than the currently targeted framework

查看:2069
本文介绍了主参考无法得到解决,因为它是建立对.NET框架比当前目标框架的更高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个引用第三方SlingshotClient.dll的项目。该项目建立在精细其他开发人员工作站。不过,我得到下面的错误。我能想象是有利于我的问题的一个区别是,我也有VS 2012和我的机器安装了.NET Framework 4.5。我相信,其他开发人员可以构建这种成功,没有那些安装。

I am trying to build a project that references a 3rd party SlingshotClient.dll. The project builds fine on other developers workstations. However, I am getting the error below. One difference that I could imagine is contributing to my issue is that I also have VS 2012 and .NET Frameworks 4.5 installed on my machine. I believe the other developers that can build this successfully, don't have those installed.

C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ Microsoft.Common.targets(1578,5):警告MSB3274:主要参考SlingshotClient,版本= 1.0.0.0,文化=中性公钥= bb5a8745472e181a,的ProcessorArchitecture = MSIL无法得到解决,因为它是建立在对.NETFramework,版本= V4.5的框架。这是一个较高versio ñ比当前目标框架.NETFramework,版本= 4.0版。

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3274: The primary reference "SlingshotClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bb5a8745472e181a, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher versio n than the currently targeted framework ".NETFramework,Version=v4.0".

该错误似乎是说,我们项目的目标4.0框架的版本(这是正确的),但所引用的SlingshotClient.dll建目标框架4.5版。当我看SlingshotClient.dll的伪君子,在我看来,该组件是建立目标框架4.0版

The error seems to be saying that our project targets the framework version 4.0 (which is correct), but the referenced SlingshotClient.dll was built targeting framework version 4.5. When I look at the SlingshotClient.dll in the dissembler, it looks to me that the assembly was built targeting framework version 4.0

推荐答案

显然,如果你只安装了.NET Framework 4.0,你可以添加一个参考.NET程序集的目标4.5到面向.NET 4.0的项目。这将编译并没有错误运行。

Apparently if you have only .NET Frameworks 4.0 installed, you can add as a reference a .NET assembly that targets 4.5 to a project that targets .NET 4.0. This will compile and run with no errors.

只要你安装了.NET Framework 4.5,编译将会失败。该解决方案是针对你的项目的.NET Framework 4.5或得到一个版本所引用的大会,面向.NET 4.0的。

As soon as you install .NET Frameworks 4.5, compile will fail. The solution is to target your project for .NET Framework 4.5 or get a version of the referenced assembly that targets .NET 4.0.

.NET 4.5是在更换下降为4.0。 4.0不知道任何有关4.5,而我认为它只是望着这对于4.0或4.5的相同版本号的第一个数字,所以它是允许编译。只要你安装4.5,你的4.0项目编译使用4.5框架和它现在知道大约4.5和抱怨。

.NET 4.5 is a drop in replacement for 4.0. 4.0 doesn't know anything about 4.5, and I assume it is just looking at the first digit of the version number which for 4.0 or 4.5 is the same, so it is allowed to compile. As soon as you install 4.5, your 4.0 projects are compiled using the 4.5 Frameworks and it now knows about 4.5 and complains.

这篇关于主参考无法得到解决,因为它是建立对.NET框架比当前目标框架的更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆