Export (0) Print
Expand All

ProjectItem.FileNames Property

Gets the full path and names of the files associated with a project item.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

string this[
	short index
] { get; }

Parameters

index
Type: System.Int16

Required. The index of file names from 1 to FileCount for the project item.

Property Value

Type: System.String
A string representing the full path and names of the files associated with a project item.

Most project items have only one file associated with them, but some languages can occasionally have multiple files per item. For example, a ProjectItem for a form in Visual Basic and Visual C# represents the source file, which can have another project item such as a .resx file.

When the project item's ProjectItems property has a value, and the ProjectItem object represents a filter folder on the disk, then the FileNames property returns only the name of the filter folder.

Sub FileNamesExample()
   Dim proj As Project
   Dim projitems As ProjectItems

   ' Reference the current solution and its projects and project items.
   proj = DTE.ActiveSolutionProjects(0)
   projitems = proj.ProjectItems

   ' List the file name associated with the first project item.
   MsgBox(projitems.Item(1).FileNames(1))
End Sub

Show:
© 2014 Microsoft