如何从 Visual Studio 2010 中的自定义属性表设置 PlatformToolset [英] How to set PlatformToolset from custom property sheet in Visual Studio 2010

查看:26
本文介绍了如何从 Visual Studio 2010 中的自定义属性表设置 PlatformToolset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在从 VS 2005 迁移到 VS 2010,产品由少数解决方案组成,每个解决方案都有很多项目.我想利用属性表系统,以便我们的众多配置更易于维护.

I am moving now from VS 2005 to VS 2010 with products consisting of few solutions with numerous projects each. I wanted to make use of the property sheets system so our numerous configurations would be easier to maintain.

其中一个问题是我们想要使用 Windows SDK 7.1(因为我们需要 BaseClasses 示例 - 如果我们必须使用该示例,为什么不使用整个 SDK)?但这需要我在所有解决方案中的每个项目上更改 PlatformToolset.此外,我们必须记住为新添加的项目更改该值.相当糟糕的主意.

One of the issues is that we want to use Windows SDK 7.1 (as we need BaseClasses sample - and if we have to use that sample that why not the entire SDK)? But this requires me to change PlatformToolset on each and every single project in all the solutions. Also we will have to remember to change that value for newly added projects. Rather bad idea.

所以我想从自定义属性表中设置它(除其他外).在属性表上设置属性时,直接从显示的对话框中没有这样的选项.手动向 XML 文件添加条目也无济于事(但我也没有看到任何错误或警告消息).

So I wanted to set this (among other things) from a custom property sheet. There is no such option directly from dialog shown when setting properties on property sheet. Adding entries manually to the XML file didn't help as well (but I haven't also seen any error or warning message).

那我应该如何设置默认的 PlatformToolset 值?充其量在可以提交到存储库的配置文件中.但如果可以在某些计算机本地设置中完成,那也是可以接受的.

Then how am I supposed to set default PlatformToolset value? At best in a configuration file which can be committed to repository. But if it could be done in some computer local settings then it would be acceptable too.

(请注意,我知道我可以以不同的方式使用 BaseClass 并完全避免该问题,但我认为这本身就是一个有趣的问题.)

(Note that I know that I can use BaseClasses differently and avoid that problem at all but I think it is interesting issue in itself.)

我也在 MSDN 表单.

推荐答案

PlatformToolset 必须在文件开头的项目属性中设置,然后才能包含其他文件,以便以后可以使用它来设置一些默认值.如果设置了 non ,那么这些包含项会将其设置为某个默认值.

PlatformToolset must be set in project properties at the begin of the file before inclusion of other files so that it can be later used to set up some defaults. If non is set then those inclusions will set it up to some default value.

即使工作也没有意义,因为一切都已经包含/设置,所以稍后重置它.因此,要将默认值更改为不同的 SDK,似乎应适当更改 VS 配置文件(包含的文件).

Resetting it later even if works is pointless as everything was already included/set up. So to change the default value to a different SDK it seems VS configuration files (those which are included) should be changed appropriately.

但这不一定是好事,因为它是机器本地的.

But this does not have to be a good thing because it is local for the machine.

还有一个手动包含属性文件的选项,它在默认包含之前设置 PlatformToolset.但是 MS 警告说,如果项目文件没有保持正确的顺序(这会破坏顺序),用于项目设置的 VS GUI 工具可能无法正常工作.

There is also an option of manual inclusion of property file which sets the PlatformToolset before default inclusions. However MS warns that if project file does not keep proper order (and this would spoil the order) VS GUI tools for project set up might not work properly.

最后我只是手动更改了所有项目.新项目也必须更改为新的 PlatformToolset.

In the end I just manually changed all projects. New projects also have to be changed to the new PlatformToolset.

这篇关于如何从 Visual Studio 2010 中的自定义属性表设置 PlatformToolset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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