Search code examples
visual-studioc++17propertysheet

How to set stdcpp+17 in a property sheet for Visual Studio 2017?


I have a solution with a large number (120+) of projects. I'd like to enable stdc++-17 in all of them without changing each individual project. We are already using a property sheet. I just can't figure out how to add the flag with the proper nesting. I believe the proper syntax for the flag is as below, but not sure what it should be nested inside:

<PropertyGroup>
    <LanguageStandard>stdcpp17</LanguageStandard>
</PropertyGroup>

This does not work. Does anyone the proper way to do this?


Solution

  • That is a compiler setting, which should go into a ClCompile section. To have it apply to all configurations, leave the section not qualified with any additional Condition.

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <!-- ... -->
      <ItemDefinitionGroup>
        <ClCompile>
          <LanguageStandard>stdcpp17</LanguageStandard>