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

How to customise Microsoft.Cpp.Win32.User.props for VS2017?

本文关键字:Cpp Win32 User props Microsoft 自定义 VS2017      更新时间:2023-10-16

传统上,我们已经能够设置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:SDKsboost_1_53_0;$(IncludePath)</IncludePath>
  </PropertyGroup>
  <PropertyGroup Condition="$(PlatformToolset) == 'v120'">
    <IncludePath>C:SDKsboost_1_59_0;$(IncludePath)</IncludePath>
  </PropertyGroup>
  <PropertyGroup Condition="$(PlatformToolset) == 'v140'">
    <IncludePath>C:SDKsboost_1_64_0;$(IncludePath)</IncludePath>
  </PropertyGroup>

但是我不知道如何为Visual Studio 2017做到这一点。什么版本的PlatformToolset是正在使用,还是完全放弃了它?

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

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

使用 PlatformToolset = v141 工作正常。