3

I'm iterating through a solution and its projects and items and need to retrieve the path to the items on disk.

I can retrieve the project file name from Project.FullName and can get a project items path using ProjectItem.Properites.Item("FullPath").

However, for an item in the solutions 'Solution Items' folder, the items Properties member is null and has no other properties which I can see could help me retrieve the path to the item.

Although by default it will be located in the same directory as the solution when it is added I can't rely on this assumption as it could be moved or added as a pre-existing item from another location.

Is there another way or something I'm missing to find the location of this file?

gouldos
  • 1,015
  • 1
  • 16
  • 30

2 Answers2

3

Take a look here, particuarly the "FileNames" property: http://msdn.microsoft.com/en-us/library/envdte.projectitem.aspx

kyndigs
  • 3,074
  • 1
  • 18
  • 22
0

Try this:

var fullPath = ProjectItem.get_FileNames(1);

I don't know why they don't start from 0

p.s.w.g
  • 146,324
  • 30
  • 291
  • 331