locked
Add-In: set a path containing macro in an object VCFile RRS feed

  • Question

  • Hello,

    I am building an extension that needs to programmatically set the path of a VCFile object. This path containts user macros (ex: "$(Foo)\Test.cpp").

    The only path property with an availiable setter is the RelativePath (FullPath and UnexpandedRelativePath are read-only) but contrary to the documentation, this setter does not support macros (UnexpandedRelativePath containts Xml encoded characters for '$', '(' and ')' ).

    Note:

    Paths based on macros work if they are defined in the vcxproj, ex:
    -------
    With $(Foo) = Sources

    MacroOk.cpp defines in vcxproj as <ClCompile Include="$(Foo)\MacroOk.cpp" />
    RelativePath: "Sources\MacroOk.cpp"
    FullPath: "E:\VSIXSetVCFilePath\CppTestProject\Sources\MacroOk.cpp"
    UnexpandedRelativePath: "$(Foo)\MacroOk.cpp"

    Test.cpp with the path set to "$(Foo)\Test.cpp" via VCFile
    RelativePath: "$(Foo)\Test.cpp"
    FullPath: "E:\VSIXSetVCFilePath\CppTestProject\$(Foo)\Test.cpp"
    UnexpandedRelativePath: "%24%28Foo%29\Test.cpp"
    -------

    Thanks, gb.
    Friday, July 13, 2018 2:56 PM

All replies