问题描述
我想知道是否可以根据您使用的VS版本为VC ++项目设置PlatformToolset属性的值.我们希望能够在PlatformToolset V100的基础上针对VC10和VC11使用我们的VC10项目 当使用VC10时,使用PlatformToolset V110;当使用VC11时,使用PlatformToolset V110.能够通过一组项目(其中有大约100个项目)做到这一点,因此我们不必为了更改仅一个设置而重复每个项目,并且可以进行项目维护 进入未来要容易得多.
I was wondering if it's at all possible to set the value of the PlatformToolset property for VC++ projects based on which version of VS you're using. We'd like to be able to use our VC10 projects for both VC10 and VC11, building against PlatformToolset V100 when using VC10 and PlatformToolset V110 when using VC11. Being able to do this with one set of projects (of which we have ~100) would make it so we don't have to duplicate every project in order to change just one setting, and would make project maintenance so much easier going into the future.
我尝试使用包含以下内容的属性表来实现此目的:
I've attempted to implement this using a property sheet which contains the following:
<PropertyGroup>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
</PropertyGroup>
,但似乎没有生效.我试图使用相同的属性表设置一些用户宏-例如.根据$(VisualStudioVersion)的值设置项目的输出目录和中间目录-预期效果为100%. PlatformToolset有什么特别之处,可以使通过属性表进行的设置在构建时无效或被覆盖吗?
but it does not seem to be taking effect. I've attempted setting some User Macros using the same property sheet - eg. setting the output and intermediate directories for the projects based on the value of $(VisualStudioVersion) - which worked 100% as expected. Is there something special about PlatformToolset that makes setting it via a property sheet not effective or overridden at build-time?
提前谢谢!
推荐答案
我写了一个例子,例如:
I wrote an example like:
<PropertyGroup> <PlatformToolset Condition="'
这篇关于根据VS版本设置PlatformToolset值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!