你如何添加4.0参考组件到您的构建服务器(所以编译器发现他们)?您的、编译器、组件、发现

2023-09-08 09:23:01 作者:酒痕

问题来了,当你的计算机上安装Visual Studio 2012没有Visual Studio 2010中安装了previously(我认为)。我想针对.NET 4.0,同时建立基于Visual Studio 2012年我已经设置了机无VisualStudo 2010年我结束了类似的消息:

The issue comes up when you install Visual studio 2012 on a machine without Visual studio 2010 installed previously (I think). I want to target .net 4.0, while building on Visual Studio 2012. I already have set up the machine without VisualStudo 2010. I end up with messages like:

 *Warning   2   The primary reference "blablaLibraryproject" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".    blablaExecutableproject*

这里的应答后(Can ?生成服务器与.NET 4.5成功安装部署目标4.0到服务器,只有.NET 4.0的项目安装)说:

可以解决这个问题,但你需要的4.0引用程序集添加到您的构建服务器(所以编译器发现它们),而不是   仅仅依靠.NET 4.5的版本。的

You can correct this, but you need to add the 4.0 reference assemblies to your build server (so the compiler finds them), and not just rely on the .NET 4.5 versions.

那么,你如何的添加4.0参考组件到您的构建服务器(所以编译器发现它们)的?

推荐答案

他们已经$机器页上$ psent。单从4.5改变项目的目标框架设置为4.0

They are already present on the machine. Just change the Target Framework setting of the project from 4.5 to 4.0

在该链接的问题讨论的问题是一个pretty的一个共同的程序员试图安装一个构建服务器不计回报的VS许可证。肚里pretty的远,但缺少一个原本免费提供的组成部分,多目标包.NET Framework的版本。

The problem discussed in that linked question is a pretty common one for programmers that try to setup a build server without paying for the VS license. Which goes pretty far, but is missing an otherwise freely available component, the multi-targeting packs for the .NET Framework versions.

这是拣了芝麻而丢了西瓜。然后,他们让一个致命的错误,他们从C添加引用程序集:\ WINDOWS \ microsoft.net代替。就像是在框架之前的版本.NET 4.0完成。这将导致可怕的诊断运行时异常时,内置产品跑了,只有安装了4.0的机器上。问题的提问者是pretty的幸运的,他得到了一个比较容易诊断之一。然而,这可能是一个的很多的恶化,越来越pretty的离奇TypeLoadExceptions的共同框架类型。

Which is penny-wise but pound-foolish. They then make a fatal mistake, they add reference assemblies from c:\windows\microsoft.net instead. Like it was done in framework versions prior to .NET 4.0. This causes horrible to diagnose runtime exceptions when the built product is ran on a machine that only has 4.0 installed. The asker of the question was pretty lucky, he got a relatively easy to diagnose one. That however can be a lot worse, getting pretty bizarre TypeLoadExceptions for common framework types.

您没有这个问题,你装VS所以你已经得到了多目标包。 4.0版本是在C语言中:\ Program Files文件(x86)的\参考大会\微软\ Framework.NETFramework \ V4.0。双方的MSBuild和VS知道如何找到它有没有你的帮助。只需更改项目设置,告诉他们你想要的目标4.0

You don't have this problem, you installed VS so you already got the multi-targeting packs. The 4.0 version is available in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0. Both MSBuild and VS know how to find it there without your help. Just change the project setting to tell them that you want to target 4.0