Sysprogs forums › Forums › VisualGDB › VisualGDB and property sheets
Tagged: property pages
- This topic has 7 replies, 2 voices, and was last updated 4 years, 8 months ago by support.
-
AuthorPosts
-
March 12, 2020 at 11:53 #27608victor_sParticipant
Hello.
We work with large Visual studio 2017 solution (around 30 vcxproj) with a few thousands files. Our project is multiplatform and one of the platforms is VisualGDB (Linux, MsBuild). For maintaining large amount of vcxproj, we use property page sheets (It can be added by “Property Manager” tab). Somehow it doesn’t work with VisualGDB (it can be added, but doesn’t allow configuration). Is it something that can be done?
March 12, 2020 at 16:11 #27612supportKeymasterHi,
The property sheets would still work with VisualGDB (as long as you are using MSBuild), however the VS GUI for editing them may indeed not work, as it appears to be specific to the regular MSBuild backend.
The easiest way to add meaningful settings to a property sheet would be to first set them on a specific project, and then copy the <ItemDefinitionGroup> items from the project to the property sheet (do not forget to remove the conditions).
For a quick example, please consider creating an embedded project (e.g. MSP432) and check the .props file created in the project directory. It will be a property sheet containing device-specific settings imported into the project.
March 15, 2020 at 09:48 #27641victor_sParticipantThank you, it works for common Visual Studio properties, like <Outdir> or <ClCompile>
But I didn’t succeed to define VisualGDB specific properties like <GNUConfigurationType>, <GNUToolchainPrefix>, <GNUCompilerType>. Can it be done?
March 15, 2020 at 15:16 #27642supportKeymasterThose settings are defined inside the <PropertyGroup> statements and can also be copied into the property sheet files. Simply copy the <PropertyGroup> statement from the .vcxproj file (removing the Condition attribute) into the property sheet file, and the properties will get applied as if they were defined in the .vcxproj file.
March 15, 2020 at 15:52 #27643victor_sParticipantThank you.
I found that VisualGDB specific properties do change from the property sheet. It just can’t be seen and controlled from the project property page, like other properties, so it is sort of hidden properties. No matter what written in the project property page – settings always taken from property sheet.
In some situations it can be misleading, like you define something in the property page and it doesn’t work, because property sheet redefined it.
March 17, 2020 at 07:14 #27672supportKeymasterNo problem, we will explain what is going on.
The VS property sheets have similar semantics to the #include and #define directives of the C/C++ compiler:
- The <Import> tag in a .vcxproj file (or in a .props file) is a rough equivalent of the #include directive.
- The <PropertyGroup> tag is a rough equivalent of a group of #define-s
- The Condition attribute on <PropertyGroup>, or a specific property, is equivalent to wrapping the #define-s with #ifdef/#endif
In order to understand why some properties get overridden, please locate all locations where they are defined (including the VisualGDB’s MSBuild directory and toolchain.props) and reconstruct their order by tracking the <Import> tags. E.g. if the project first imports a property sheet, and then defines the same property in a property group, the project’s property group will override the value from the property sheet. If the property sheet is imported after the definition in the .vcxproj file, it will override the regular definition.
You can also work around this by using the following syntax in the property sheet file:
<PropertyGroup> <MyProperty Condition="'$(MyProperty)' == ''">NewValue</MyProperty> </PropertyGroup>
This will only set MyProperty to NewValue if it was unset at the time when the corresponding PropertyGroup was parsed.
The default values shown in the VS GUI are taken from the Microsoft.Cpp.Default.props file that in turn includes the SysprogsPlatform.default.props. If you would like to modify them, consider importing your own property sheet right after (or before) Microsoft.Cpp.Default.props.
March 17, 2020 at 12:26 #27676victor_sParticipantThank you very much for this detailed explanation. Moving import right after Microsoft.Cpp.Default.props made everything work as expected.
April 2, 2020 at 18:03 #27817supportKeymasterJust wanted to share an updated that we have published detailed documentation on MSBuild property sheets with VisualGDB projects here: https://visualgdb.com/documentation/projects/msbuild/propertysheets/
-
AuthorPosts
- You must be logged in to reply to this topic.