I want to change the default settings for Visual Studio 2019

Bishop Minter 41 Reputation points
2021-10-07T16:40:38.763+00:00

I would like to change the default settings in VS 2019. Specifically, I want to change

C/C++ settings:

the default Conformance Mode setting from Yes(/permissive-) to No(/permissive)
the default Preprocessor Definitions setting from WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
to WIN32;_DEBUG;_CONSOLE;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)

Configuration Properties:

the default Working Directory setting from $(ProjectDir) to ..
the default Include Directories setting from $(VC_IncludePath);$(WindowsSDK_IncludePath);
to C:\DS\TEST\src\CPP;C:\DS\TEST\src\Header;$(IncludePath)

I've made a Property Sheet with the following settings:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>C:\DS\TEST\src\CPP;C:\DS\TEST\src\Header;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<ConformanceMode>false</ConformanceMode>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<PropertyGroup Label="Debugging Properties">
<LocalDebuggerWorkingDirectory>..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<ItemGroup />
</Project>

When I create a new VS 2019 project I load this Property Sheet. When I open the Property Page for the project, the Configuration Properties, Include Directories and Working Directory, reflect the changes in my Property Sheet. The C/C++ settings, however, do not reflect the changes in my Property Sheet. The default settings are still there. If I change the settings in the Property Page to <inherit from parent or project defaults> for both settings the changes in my Property Sheet now show.

I would like for all 4 settings in my Property Sheet to reflect in the project Properties Page once I load the Property Sheet.

How can I accomplish this?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,625 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,007 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 43,041 Reputation points
    2021-10-09T11:03:08.71+00:00

    I don't recommend messing with Visual Studio's defaults for building C++ projects.

    I think it is far safer to follow one of the following paths -

    1. Create your own custom project template. In your template set the properties that you want in the template's .vcxproj file. When a new project is created from your template it will have your desired settings in the project property pages. Consequently, you won't need a property sheet since all your desired setting will be contained in the .vcxproj file.
    2. Create your own custom project template. Don't set any properties in the template's .vcxproj file that you would obtain from a property sheet. Include a custom property sheet containing your desired settings in your template project. When a new project is created from this template it will have the desired settings that are present in the property sheet that is also part of the project. This option is more complicated and requires a better understanding of the build system than option1.

    Refer to creating-project-and-item-templates


1 additional answer

Sort by: Most helpful
  1. PengGe-MSFT 3,341 Reputation points
    2021-10-08T09:09:48.277+00:00

    Hi, @Bishop Minter

    Welcome to Microsoft Q&A!

    According to the inheritance tree in Property inheritance in Visual Studio projects, I created two projects for testing.I am afraid that if you want to match the settings in the project property page with the settings in the property sheet, you need to select <inherit in the project properties from parent or project defaults>.

    I found custom c++ build, you can refer to this document.

    Sincerely,
    Peng
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread