locked
Retrieving a list of classes within the projects RRS feed

  • Question

  • I have an add in in which a determine the current method I am in.

     

    That works fine.

     

    But, I need to get a list of Assemblies that the project has access to.

     

    These would include the referenced assemblies and the ones the code creates.

     

    Does anyone have any pointers on how this could be accomplished?

    Thursday, May 31, 2007 2:04 PM

Answers

  • For the classes of the source code:

     

    HOWTO: Navigate the files of a solution from a Visual Studio .NET macro or add-in.

    HOWTO: Navigate the code elements of a file from a Visual Studio .NET macro or add-in.

    http://www.mztools.com/resources_vsnet_addins.htm

     

    For the compiled references you have to use Reflection. To can get the references see:

    HOWTO: Getting information specific to VB.NET and C# projects from an add-in or macro.

    (same link)

    Friday, June 1, 2007 9:33 PM

All replies

  • Hi,

     

    I suppose that you already have a Project object, so:

     

    For the project assembly:

     

    project.Properties.Item("OutputFileName").Value.ToString();

     

    For the references:

     

    Add a reference to $DEVENVDIR$\Common7\IDE\PublicAssemblies\VSLangProj.dll

     

    VSProject vsProject = project.Object as VSProject;

     

    Then you can access the list of Reference objects by vsProject.References.

    Pablo
    Thursday, May 31, 2007 2:43 PM
  • For the classes of the source code:

     

    HOWTO: Navigate the files of a solution from a Visual Studio .NET macro or add-in.

    HOWTO: Navigate the code elements of a file from a Visual Studio .NET macro or add-in.

    http://www.mztools.com/resources_vsnet_addins.htm

     

    For the compiled references you have to use Reflection. To can get the references see:

    HOWTO: Getting information specific to VB.NET and C# projects from an add-in or macro.

    (same link)

    Friday, June 1, 2007 9:33 PM