VS.NET get item path

  • Thread starter Thread starter alexia
  • Start date Start date
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.
 
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
}
 
Back
Top