How to set PlatformToolset from custom property sheet in Visual Studio 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.

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.

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).

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.

(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.)

I also asked this question at MSDN Formus.


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.

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.

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.

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

链接地址: http://www.djcxy.com/p/46614.html

上一篇: WPF验证:清除所有验证错误

下一篇: 如何从Visual Studio 2010中的自定义属性表中设置PlatformToolset