Visual Studio解决方案/多个项目:如何在多个C ++项目之间有效传播项目属性 [英] Visual Studio Solutions / Multiple project : How to effectively propagate project properties amongst several C++ projects

查看:102
本文介绍了Visual Studio解决方案/多个项目:如何在多个C ++项目之间有效传播项目属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用包含多个项目(大约30个)的Visual Studio 2005 C ++解决方案. 根据我的经验,维护项目的所有属性(即包括路径,lib路径,链接的lib,代码生成选项等)常常变得很烦人,因为您经常必须单击每个项目才能执行以下操作:修改它们. 当您具有多种配置(调试,发行版,发行版64位等)时,情况甚至更糟.

I am working with a Visual Studio 2005 C++ solution that includes multiple projects (about 30). Based upon my experience, it often becomes annoying to maintain all the properties of the projects (i.e include path, lib path, linked libs, code generation options, ...), as you often have to click each and every project in order to modify them. The situation becomes even worse when you have multiple configurations (Debug, Release, Release 64 bits, ...).

现实生活中的例子:

  • 假设您要使用新的库,并且需要将该库的包含路径添加到所有项目. 您将如何避免不得不编辑每个项目的每个属性?
  • 假设要测试驱动一个新版本的库(例如2.1beta版),以便需要快速更改一组项目的包含路径/库路径/链接库?
  • Assume you want to use a new library, and you need to add the include path to this library to all projects. How will you avoid to have to edit the properties of each an every project?
  • Assume you want to test drive a new version of library (say version 2.1beta) so that you need to quickly change the include paths / library path / linked library for a set of projects?

注意:

  • 我知道可以一次选择多个项目,然后右键单击并选择属性".但是,此方法仅适用于对于不同项目已经完全相同的属性:您不能使用该方法向包含不同包含路径的一组项目添加包含路径.
  • 我也知道可以全局修改环境选项(工具/选项/项目和解决方案/目录),但是不能令人满意,因为它不能集成到SCM中.
  • 我还知道可以将配置"添加到解决方案中.这无济于事,因为它使另一组项目属性得以维护
  • 我知道Codegear C ++ Builder 2009通过所谓的选项集"可以为这种需求提供可行的答案,该选项集可以被多个项目继承(我同时使用Visual Studio和C ++ Builder,但我仍然认为C ++ Builder在某些方面很困难方面与Visual Studio相比)
  • 我希望有人会建议使用"autconf",例如CMake,但是是否可以将vcproj文件导入这样的工具?

推荐答案

我认为您需要调查属性文件,即

I think you need to investigate properties files, i.e. *.vsprops (older) or *.props (latest)

要做需要将属性文件手动添加到每个项目,但是一旦完成,您将拥有多个项目,但是只有一个.[vs] props文件.如果更改属性,则所有项目都将继承新设置.

You do need to add the properties file manually to each project, but once that's done, you have multiple projects, but one .[vs]props file. If you change the properties, all projects inherit the new settings.

这篇关于Visual Studio解决方案/多个项目:如何在多个C ++项目之间有效传播项目属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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