如何在 VC++ 的解决方案中定义全局设置? [英] How to have global settings defined in a solution in VC++?

查看:19
本文介绍了如何在 VC++ 的解决方案中定义全局设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多解决方案,其中包含大量项目.我希望能够为所有项目使用的解决方案定义全局设置.例如包含目录.我希望能够在一个地方为解决方案中的所有项目更改包含目录.

I have a number of solutions with a large number of projects in them. I would like to be able to define global settings for the solution that are used by all projects. For example an include directory. I want to be able to change the include directory in one place for all projects in the solutions.

当我搜索解决方案时,我发现了一个很好的问题描述: 与我的完全匹配 但那里建议的解决方案,项目属性表,是按项目而不是按解决方案定义的.

When I searched for a solution I found a good description of the problem that matches mine exactly but the solution suggested there, project property sheets, are defined per project and not per solutions.

我可以使用环境变量或 Visual Studio 设置,但是每个需要编译代码的人都必须定义完全相同的设置.

I could use environment variables or Visual studio settings, but then everyone that needs to compile the code has to define the exact same settings.

谁能建议一种方法来做到这一点?谢谢.

Can anyone suggest a way to do this? Thanks.

推荐答案

我们使用属性表来实现这一点.可以将单个属性表分配给解决方案中的所有项目.从那时起,您可以更改该属性表中的设置,它将影响所有项目.

We use property sheets to accomplish this. A single property sheet can be assigned to all the projects in the solution. From then on you can change a setting in that one property sheet and it will affect all the projects.

高级提示:我们实际上使用了多个属性表(例如,一个用于发布目标类型,一个用于调试目标类型).提示是顺序非常重要.如果您手动编辑项目文件,则最后一个属性表将覆盖列表中先前属性表中的设置.如果您在 GUI 中进行编辑,则顶部的会覆盖其下方的.

Advanced tip: We actually use multiple property sheets, (e.g. one for release target types, one for debug target types). The tip is that the order is very important. If you're editing the project files by hand then the last property sheet will override settings in the previous property sheets in the list. If you're editing in the GUI, then the TOP one overrides the ones below it.

这篇关于如何在 VC++ 的解决方案中定义全局设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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