From an extension for Visual Studio 2012, I am trying to write a custom MSBuild property to a C# project. I want to avoid using MSBuild APIs directly to edit the project files. Using the SetPropertyValue method of the IVsBuildPropertyStorage interface almost works, but it escapes special characters and can't be used to set property values with MSBuild variables in them, which I need.
I found about the IVsBuildPropertyStorage2 interface which seems to do exactly what I want, i.e. not escaping values. However, using the same syntax as with IVsBuildPropertyStorage to retrieve it doesn't work. I always end up with a null value. IVsHierarchy instances for C# projects don't seem to implement this interface.
Any idea how to get a IVsBuildPropertyStorage2?