I have been working on a custom tool and editor and I have one way to load the current project so that I can get to the references, but that is only working with the custom tool. I need to acces the current project from the custom editor. What I am currently trying is the following code. EnvDTE80.DTE2 dte2 = Marshal.GetActiveObject("VisualStudio.DTE.8.0") as EnvDTE80.DTE2; I can get the dte2 object loaded but once I have the dte2 object I try to use the following line of code which does not work. It complains about the index being out of change. I have also tried 0 in place of the 1 but that also does not work. Project project = dte2.Solution.Projects.Item(1).ProjectItems.ContainingProject; What can I do to access the current project?
Just to state the obvious, you have at least 1 project in your solution right? Try iterating over the Projects collection in a foreach loop instead and see what you get.