Search code examples
visual-studiovsprops

CharacterType/ConfigurationType in vsprops


I've been using Visual Studio's property sheets for building my code and I have a useful hierarchy of sheets controlling the build settings, rather than having them in the vcproj files. This is great except for one thing. I can't seem to set properties in the Project Defaults section such as CharacterType and ConfigurationType.

I tried using a VCConfiguration tool in the vsprops but to no avail:

<Tool
    Name="VCConfiguration"
    ConfigurationType="4"
/>

Can anyone tell me how this is accomplished please?


Solution

  • That's because the Project Default settings change a bunch of settings, not just one. The CharacterType is the easier one, this .vsprops file changes it to Unicode:

    <?xml version="1.0"?>
    <VisualStudioPropertySheet
            ProjectType="Visual C++"
            Version="8.00"
            Name="Unicode Support">
            <Tool
                    Name="VCCLCompilerTool"
                    PreprocessorDefinitions="_UNICODE;UNICODE"/>
            <Tool
                    Name="VCResourceCompilerTool"
                    PreprocessorDefinitions="_UNICODE;UNICODE"/>
    </VisualStudioPropertySheet>
    

    ConfigurationType however changes a lot of them. The best thing to do is to start with a vanilla project template. Save the .vcproj file. Change the ConfigurationType and save again. Run a diff on the two .vcproj files to see what settings you should include in your project property sheet. You'll then also easily see that the ConfigurationType element is actually in the <Configurations/Configuration> section.