VS2022 .vcxproj.user UserMacros properties not applying to .vcxproj fields
Hello! I am relatively new to understanding the .vcxproj schema, but I cannot find solutions for what we want to do.
We are programmatically generating our .vcxproj file with a custom NMake build commandline. I want individual users to be able to append commandline args from a .vsix extension.
To facilitate this, I had the idea to add a custom macro to the generated commandline in the .vcxproj file (so that the .vcxproj file itself remains static). This works if I define the custom macro inside the .vcxproj file itself:
<PropertyGroup Label="UserMacros">
<DynamicVSIXBuildArguments>-MyAddedBuildArg=Value</DynamicVSIXBuildArguments>
</PropertyGroup>
...
<PropertyGroup>
<NMakeBuildCommandLine>../Path/To/My/Build.bat MyProjName $(DynamicVSIXBuildArguments)<NMakeBuildCommandLine>
...
However, if I move the <PropertyGroup Label="UserMacros">
block into the .vcxproj.user file, the macro doesn't resolve in the build commandline (it's resolved to nothing). I even had the vsix extension writing the property to the user file using this code:
IVsBuildPropertyStorage PropertyStorage = ...
...
PropertyStorage.SetPropertyValue("DynamicVSIXBuildArguments", null, (uint)_PersistStorageType.PST_USER_FILE, "-MyAddedBuildArg=ValueFromVSIX");
And by default that writes to a "UserMacros" property block without me having to specify it.
I know I was kind of blindly hoping this would work, but would like to understand why it doesn't, and how I might achieve my original goal.
Thanks!