< ?xml version="1.0" encoding="Windows-1252"? >This is cool, you can modify which vsprops file will be inherited by an externally defined environment variable, before starting Visual Studio. Ok fine, then try further:
< VisualStudioPropertySheet
projecttype="Visual C++"
version="8.00"
name="whatever" inheritedpropertysheets=".\randomprefix_$(RANDOM_ENVIRONMENT_VARIABLE).vsprops">
< /VisualStudioPropertySheet >
< ?xml version="1.0" encoding="Windows-1252"? >Cool again! I can use locally defined variable in Visual Studio. Ok, then let's try to do something useful:
< VisualStudioPropertySheet
projecttype="Visual C++"
version="8.00"
name="whatever" inheritedpropertysheets="$(SolutionDir)..\randomdir\random_file.vsprops">
< /VisualStudioPropertySheet >
< ?xml version="1.0" encoding="Windows-1252"? >It fails. :( That would have been useful: include a vsprops file named after the current configuration name (debug or release or whatever). Here a counter example:
< VisualStudioPropertySheet
projecttype="Visual C++"
version="8.00"
name="whatever" inheritedpropertysheets="randomprefix_$(ConfigurationName).vsprops">
< /VisualStudioPropertySheet >
< ?xml version="1.0" encoding="Windows-1252"? >Yes, that actually works. In fact, you can even set « CharacterSet="1" » in the vsprops even if the VS vsprops editor doesn't allow you to set this (the same applies to WholeProgramOptimization). So it seems like $(ConfigurationName) and $(SolutionDir) aren't defined at the same time, which is normal. The way VS looks at the project file looks like this:
< VisualStudioPropertySheet
projecttype="Visual C++"
version="8.00"
name="whatever" outputdirectory="$(SolutionDir)$(ConfigurationName)" >
< /VisualStudioPropertySheet >
- Initial parsing
- For each Configuration in Configurations
- Load the InheritedPropertySheets attribute
- Open recursively the property sheets
- Load the Name attribute in Configuration in the vcproj
- Process property sheets
- Process the rest of the
attributes - Load the rest
Disclaimer: I didn't try with VS2008.
Disclaimer: I know the blogger's editor sucks and that I couldn't write real XML. In fact, they know it too. I just wished they cared. We're just all eager to have it actually fixed.