locked
Evaluating project properties/macros for a VC++ project RRS feed

  • Question

  • Is there a way to get a IVsBuildMacroInfo for a VC++ project in order to evaluate project properties/macros?

    I know for a C# project you can cast the IVsHierarchy for a project to IVsBuildMacroInfo but this doesn't work for a VC++ project.

    I also know that VCConfiguration.Evaluate can be used for similar functionality in a VC++ project.  A drawback to this though is that I have an extension that works for multiple versions of Visual Studio and the VCProjectEngine COM interfaces are re-GUID'd for each version of Visual Studio.

    It seems that if IVsBuildMacroInfo is supported somehow for VC++ projects that would be the best option.  Alternatively, are there other good options for evaluating project properties/macros in a VC++ project that work across multiple versions of Visaul Studio?

    Thursday, December 5, 2013 5:50 PM

Answers

  • I ended up using VCConfiguration.Evaluate, but invoked it via reflection to avoid having to deal with the separate versions of VCProjectEngine per version of Visual Studio.  This worked out well.
    • Marked as answer by ewells Monday, December 16, 2013 9:01 PM
    Monday, December 16, 2013 9:01 PM

All replies

  • Hi,

    Thank you for sharing the solution you have already found.

    >>It seems that if IVsBuildMacroInfo is supported somehow for VC++ projects that would be the best option.

    You can provide your suggestions on the Visual Studio UserVoice site so that we could make the products related to  Visual Studio become better.

    >>Alternatively, are there other good options for evaluating project properties/macros in a VC++ project that work across multiple versions of Visaul Studio?

    I am not sure of the specific method,please check if the MSBuild Property Evaluation could provide some helpful information.

    Here are some related links below:

    Macros in Project System Properties

    Microsoft.Build.Evaluation Namespace

    Best Regards,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Jane Wang - MSFT Friday, December 13, 2013 9:34 AM
    • Unmarked as answer by ewells Monday, December 16, 2013 9:02 PM
    Friday, December 6, 2013 3:52 AM
  • I ended up using VCConfiguration.Evaluate, but invoked it via reflection to avoid having to deal with the separate versions of VCProjectEngine per version of Visual Studio.  This worked out well.
    • Marked as answer by ewells Monday, December 16, 2013 9:01 PM
    Monday, December 16, 2013 9:01 PM