Importing MSBuild Property Sheets

VisualGDB supports importing variables from MSBuild property sheets, so that they can be used anywhere throughout VisualGDB Project Properties. This page provides brief instructions to do it.

First of all, create a property sheet file (e.g. test.props) that will define the necessary properties inside a PropertyGroup with the “UserMacros” label:

Then, add the following lines to the .vgdbsettings file (or the .vgdbcmake/.vgdbproj file when using advanced project types) directly under the VisualGDBProjectSettings2 element:

The Path element should contain the relative path to the property sheet file that is being imported.

The $(TestProperty) expression can now be referenced anywhere in the VisualGDB Project Properties (e.g. directory uploading settings, build commands, custom build/debug actions). You can test it by adding a custom pre-build action running “cmd.exe /c echo $(TestProperty)“. In this example, it will output “TestValue“.

Although VisualGDB cannot fully evaluate MSBuild conditions, you can use the syntax below to limit the properties imported by VisualGDB:

This will restrict the imported variables to variables with no condition and variables where the condition is set to exactly ‘$(Configuration)’ == ‘Debug’.