locked
VSPackage: How to get the project GUID from a VCReference or Name RRS feed

  • Question

  • I have an instance of VCReference. Is it possible to access the member ReferencedProjectIdentifier somehow, or, lacking that option, to retrieve the Guid from some IVsSolution or some other interface via the VCReference.Name property?

    Note that the VCReference.Name property is not the same as Project.UniqueName, which would allow for me to get the information I need. Furthermore, the referenced project may be unloaded in the solution.

    Lastly, as a work around, it would also help if there were some way to access the elements of the .sln file programmatically: For each project in the solution, there is an entry in the sln file which actually contains the exact information I need (project file name, project name, project GUID). So, basically, what I would like to do is something like:

    SomeSLNFileReader rdr;

    foreach (entry in rdr.items)

    {

      Guid g =  entry.Guid;

      string name = entry.Name;

    }

    BR,

      Matthias

    Thursday, November 1, 2012 11:52 AM

Answers

  • Hi Ego,

    thanks for your reply.

    Basically, what I wanted was the Guids of the referenced projects. My mistake was trying to get this information from the VCReference instance. I ended up using the IVsSolutionBuildManager, getting the referenced projects (as IVsHierarchy collection), and then getting the Guids for all of those.

    BR,

      Matthias

    • Marked as answer by Ego Jiang Thursday, November 8, 2012 2:31 AM
    Monday, November 5, 2012 9:41 AM

All replies

  • Hi Matthias,

    Did you want to get the guid in your solution?

    If yes, I think you can try using Projects..::.Kind Property.

    You can find an example to use it from:

    http://msdn.microsoft.com/en-us/library/envdte.projects.kind.aspx

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 5, 2012 6:40 AM
  • Hi Ego,

    thanks for your reply.

    Basically, what I wanted was the Guids of the referenced projects. My mistake was trying to get this information from the VCReference instance. I ended up using the IVsSolutionBuildManager, getting the referenced projects (as IVsHierarchy collection), and then getting the Guids for all of those.

    BR,

      Matthias

    • Marked as answer by Ego Jiang Thursday, November 8, 2012 2:31 AM
    Monday, November 5, 2012 9:41 AM