Get path of a Solution Item file in Visual Studio Add-In

gouldos picture gouldos · Oct 18, 2010 · Viewed 7.5k times · Source

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?

Answer

kyndigs picture kyndigs · Oct 18, 2010

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