构建针对框架3.5但生成针对框架4.0的程序集的C ++项目 [英] Building C++ projects that targets framework 3.5 but produces assemblies targeting framework 4.0

查看:69
本文介绍了构建针对框架3.5但生成针对框架4.0的程序集的C ++项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我们有一个C ++解决方案,该解决方案已从VS2005移至VS2010,其中项目文件针对的是.net Framework 3.5,但是自移至VS2010之后,所有项目文件都表明它们针对的是.net Framework 4.0. .此后,我已使用

We have a C++ solution that has been moved from VS2005 to VS2010 where the project files were targeting the .net framework 3.5 but since moving over to VS2010, all of the project files were showing that they were targeting the.net framework 4.0. I have since changed the .vcxproj files manually so that they are targeting the .net framework 3.5, using the method described in the Community Content on this link

问题

当我手动或通过自动构建这些项目文件时,输出程序集仍以.net Framework 4.0为目标.我可以使用此处中所述的各种方法来告知这一点.我也知道在为该应用程序生成并运行安装程序时就是这种情况.一旦安装了应用程序(然后显示为服务),我尝试在目标计算机上启动该服务.未安装.net Framework 4.0的计算机上不会启动此服务.如果随后安装了4.0,则该服务将启动,因此这是我可以运行的另一项测试,向我显示该应用程序具有对.net Framework 4.0的依赖,而不应依赖于它.

When I build these project files, manually or via an automated build, the output assemblies are still targeting the .net framework 4.0. I can tell this by using various methods described here. I also know that this is the case as I build and run the installer for this application. Once the application has been installed (which then shows as a service), I try to start the service on the target machine. This service will not start on a machine without the .net framework 4.0 installed. If 4.0 is then installed, the service will start, so this is another test that I can run that shows me that the application has a dependency on .net framework 4.0 which it should not.

目标

理想情况下,我需要构建此应用程序,以使输出的目标是.net框架3.5而不是4.0,以便它实际上可以按预期的方式运行!我已尝试使用针对此问题给出的答案之一中所述的MSBuild 3.5版本

Ideally, I need to build this application so that the outputs are targeting the .net framework 3.5 instead of 4.0 so that it will actually run as it is supposed to! I have tried to use the 3.5 version of MSBuild as described in one of the answers given for this question here but got the same error that is described underneath that post.

有人可以帮忙吗?事实证明这是一种正确的痛苦,并且我已经将头部撞在墙上超过一个星期,试图将其分类!

Can anyone help with this? It's proving to be a right pain and I've been banging my head against the wall for over a week trying to get this sorted!

再次感谢

推荐答案

请确保您遵循全部所发布的第一个链接中提供的说明.

Make sure you follow all the instructions as provided in the first link you posted.

例如

  1. 确保在生成服务器上安装了Visual Studio 2008.

  1. Make sure you have Visual Studio 2008 installed on the build server.

确保您还将每个项目的平台工具集"都更改为v90.

Make sure you also change each project's "Platform Toolset" to v90.

验证项目的框架版本:在解决方案资源管理器中,右键单击您的项目,然后单击属性".在属性页"窗口的左窗格中,展开通用属性",然后选择框架和引用".新的Framework版本将显示在右窗格的顶部."

Verify the project's framework version: "In Solution Explorer, right-click your project and then click Properties. In the Property Pages window, in the left pane, expand Common Properties and then select Framework and References. Verify that the new Framework version appears at the top of the right pane."

这篇关于构建针对框架3.5但生成针对框架4.0的程序集的C ++项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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