DefineConstants overwrite behavior may cause confusion. #7779
-
I believe this is operating "as expected", but the behavior was still slightly confusing, and the current documentation provided no insight. My goal was to define a WiX constant which mirrored a solution property (as described in the documentation at https://wixtoolset.org/docs/tools/msbuild/#centralizing-msbuild-properties-and-targets). Per the sample, I defined the project-level constant in a property group with the "Globals" label (in case that was significant), but my constant was not recognized during the build. After some searching, I realized that it was because I was triggering a debug build, and that a subsequent This behavior is consistent with other properties in project files - I.e. a "last change wins" scenario - but it still came as an unexpected surprise. What would have caused less confusion is if subsequent |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
What you described is MSBuild behavior. You have to prepend/append Properties manually like: <PropertyGroup>
<DefineConstants>$(DefineConstants);Foo=bar</DefineConstants>
</PropertyGroup> I don't know if the MSBuild documentation describes this behavior or pattern but you could go search their documentation and if not, feel free to make a suggestion to them. |
Beta Was this translation helpful? Give feedback.
-
I understand that, but I was still confused. I hadn't expected to need to jump through that hoop just because a checkbox got checked or unchecked in Visual Studio. FWIW, even having made that adjustment in the main installation, the property is still not recognized resulting in a WIX0150 error at build time. I'm going to keep poking at it as, for now, there is clearly something I'm missing going on. I also created a minimal sample (to make sure I was seeing what I thought), which I've attached here. It works more as I was expecting, but if you open it in Visual Studio + Heatwave, go to the "Build" entry in the properties view, and toggle the "Define DEBUG constant" you'll note that the use of the property reference goes away which also seems like it might not be ideal. |
Beta Was this translation helpful? Give feedback.
-
Since it seems WiX is operating "as designed", there seems to be no benefit to keeping this discussion open. Closing it to reduce clutter. |
Beta Was this translation helpful? Give feedback.
What you described is MSBuild behavior. You have to prepend/append Properties manually like:
I don't know if the MSBuild documentation describes this behavior or pattern but you could go search their documentation and if not, feel free to make a suggestion to them.