Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get ProjectItem path without using item.Document.FullName

I have a visual studio add-in project where I must iterate through the current project's items, utilizing the absolute (or relative) path to those files.

The item.Document.FullName works, but only for files that are currently opened.

Is there any other way to access this information in the DTE object?

like image 415
Jason Avatar asked Jul 19 '11 21:07

Jason


2 Answers

Is this what you're looking for?

myProjectItem.Properties.Item("FullPath").Value
like image 136
puremic Avatar answered Oct 18 '22 21:10

puremic


Even I was looking for a solution to get the project name based on the document or file Name. I found it by using the DTE object. Initialized the DTE object like the code shown below.

EnvDTE80.DTE2 objDTE = this.GetService(typeof(SDTE)) as EnvDTE80.DTE2;

Then I used following code, to get the name of the project.

var projectItem = objDTE.Solution.FindProjectItem(document);
var projectUniqueName = projectItem.ContainingProject.UniqueName;
like image 22
shekhar Kumar Avatar answered Oct 18 '22 21:10

shekhar Kumar