[Answering my own question]
InheritsFromParent
means prepend. To verify this, I did an experiment that reveals how User Macros work in Visual Studio 2008. Here's the setup:
- Project
p.vcproj
includes the property sheet file d.vsprops
('d' for derived) using the InheritedPropertySheets
tag.
d.vsprops
includes the property sheet file b.vsprops
('b' for base.)
p.vcproj
also defines a Pre-Build Event which dumps the environment.
- Both
.vsprops
files contain User Macro definitions.
b.vsprops
...
<UserMacro Name="NOENV" Value="B"/>
<UserMacro Name="OVERRIDE" Value="B" PerformEnvironmentSet="true"/>
<UserMacro Name="PREPEND" Value="B" PerformEnvironmentSet="true"/>
...
d.vsprops
...
<VisualStudioPropertySheet ... InheritedPropertySheets=".\b.vsprops">
<UserMacro Name="ENV" Value="$(NOENV)" PerformEnvironmentSet="true"/>
<UserMacro Name="OVERRIDE" Value="D" PerformEnvironmentSet="true"/>
<UserMacro Name="PREPEND" Value="D" InheritsFromParent="true"
Delimiter="+" PerformEnvironmentSet="true"/>
...
p.vcproj
...
<Configuration ... InheritedPropertySheets=".\d.vsprops">
<Tool Name="VCPreBuildEventTool" CommandLine="set | sort"/>
...
build output
...
ENV=B
OVERRIDE=D
PREPEND=D+B
...
From these results we can conclude the following:
PerformEnvironmentSet="true"
is necessary for User Macros to be defined in the environment used for build events. Proof: NOENV
not shown in build output.
- User Macros are always inherited from included property sheets regardless of
PerformEnvironmentSet
or InheritsFromParent
. Proof: in b.vsprops
, NOENV
is not set in the environment and in d.vsprops
it is used without need of InheritsFromParent
.
- Simple redefinition of a User Macro overrides any previous definition. Proof:
OVERRIDE
is set to D
although it was earlier defined as B
.
- Redefinition of a User Macro with
InheritsFromParent="true"
prepends the new definition to any previous definition, separated by a specified Delimiter
. Proof: PREPEND
is set to D+B
(not D
or B+D
.)
Here are some additional resources I found for explanation of Visual Studio .vsprops
files and related topics, it's from a few years back but it is still helpful:
understanding the VC project system part I: files and tools
understanding the VC project system part II: configurations and the project property pages dialog
understanding the VC project system part III: macros, environment variables and sharing
understanding the VC project system part IV: properties and property inheritance
understanding the VC project system part V: building, tools and dependencies
understanding the VC project system part VI: custom build steps and build events
understanding the VC project system part VII: "makefile" projects and (re-)using environments