VS.NET get item path

A

alexia

Hi,

I have no idea if this is the right place for this question so please
forgive me.
I am trying to develop VS.NET add-in in C#.
The problem I am facing is that I have no idea how to get the path of
the selected item in the "Solution Explorer" window.

I've added new menu to the context menu of the soltion and the
project. I can get the path to the active document but when using
right click the mouse button, I want to get the item path of which he
selected.

Thank you for your help.
 
A

alexia

Hi,

I have no idea if this is the right place for this question so please
forgive me.
I am trying to develop VS.NET add-in in C#.
The problem I am facing is that I have no idea how to get the path of
the selected item in the "Solution Explorer" window.

I've added new menu to the context menu of the soltion and the
project. I can get the path to the active document but when using
right click the mouse button, I want to get the item path of which he
selected.

Thank you for your help.

Ok, just fuond out.

SelectedItem selItem = applicationObject.SelectedItems.Item(1);
if(selItem.Project != null)
{
name = selItem.Project.FullName; //If user clicked on project
}
else
{
name = applicationObject.Solution.FileName;//If user clicked on
solution
}
 

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

Similar Threads


Top