如何为VS2017自定义Microsoft.Cpp.Win32.User.props?

时间:2017-05-13 07:58:47

标签: c++ visual-studio-2017

传统上,我们已经能够设置Microsoft.Cpp.Win32.User.props文件,以帮助我们使用PlatformToolset为不同版本的Visual Studio进行不同的设置:

Visual Studio 2012 = v100

Visual Studio 2013 = v120

Visual Studio 2015 = v140

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0">
  <PropertyGroup Condition="$(PlatformToolset) == 'v100'">
    <IncludePath>C:\SDKs\boost_1_53_0;$(IncludePath)</IncludePath>
  </PropertyGroup>
  <PropertyGroup Condition="$(PlatformToolset) == 'v120'">
    <IncludePath>C:\SDKs\boost_1_59_0;$(IncludePath)</IncludePath>
  </PropertyGroup>
  <PropertyGroup Condition="$(PlatformToolset) == 'v140'">
    <IncludePath>C:\SDKs\boost_1_64_0;$(IncludePath)</IncludePath>
  </PropertyGroup>

但我无法弄清楚如何为Visual Studio 2017做到这一点。什么版本的 PlatformToolset是使用它还是完全丢弃了?

1 个答案:

答案 0 :(得分:0)

刚刚在我的.vcxprof文件中找到了这个:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>

使用PlatformToolset = v141可以正常工作。