Visual Studio 200x Automation and Extensibility (Add Reference)

G

Greg

Greetings

Does anyone know how to get the current active (selected) project from
a Visual Studio solution that has more than 2 projects?

I can't seem to figure out how to accomplish this. I've exhausted the
VSLangProj, VSLangProj2, VSLangProj80 object models and still can't
seem to figure this out.

I would have expected an API such as DTE.Solution.GetActiveProject()

I've developed an AddIn that, when right-clicking on the Solution
Explorer's References root node, provides the ability to obfuscate the
binary, re-apply a strong-name, apply authenticode, and finally add's
the assembly reference to the project. This works if there is only one
project in the solution ,however, there is no way for me to know if
the user is adding an assembly reference for a (say 3rd) project in
the list.

anyone?

many thanks
 
P

Pavan Raut

Hi Greg,

Try doing something like this to get the active project.


Project project = (_applicationObject.ActiveSolutionProjects as object[])[0] as Project

This will give you the reference of EnvDTE project object and then do:

VSProject2 proj = (VSProject2) project.Object;

Hope this helps



Posted as a reply to:

Visual Studio 200x Automation and Extensibility (Add Reference)

Greetings

Does anyone know how to get the current active (selected) project from
a Visual Studio solution that has more than 2 projects?

I can't seem to figure out how to accomplish this. I've exhausted the
VSLangProj, VSLangProj2, VSLangProj80 object models and still can't
seem to figure this out.

I would have expected an API such as DTE.Solution.GetActiveProject()

I've developed an AddIn that, when right-clicking on the Solution
Explorer's References root node, provides the ability to obfuscate the
binary, re-apply a strong-name, apply authenticode, and finally add's
the assembly reference to the project. This works if there is only one
project in the solution ,however, there is no way for me to know if
the user is adding an assembly reference for a (say 3rd) project in
the list.

anyone?

many thanks

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorial...a-6dafb17b6d74/wcf-workflow-services-usi.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top