ProjectItem.FileNames Property

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

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

Syntax

'Declaration
ReadOnly Property FileNames ( _
    index As Short _
) As String
string this[
    short index
] { get; }
property String^ FileNames[[InAttribute] short index] {
    String^ get ([InAttribute] short index);
}
abstract FileNames : 
        index:int16 -> string with get
JScript does not support indexed properties.

Parameters

Property Value

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

Remarks

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.

Examples

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

.NET Framework Security

See Also

Reference

ProjectItem Interface

EnvDTE Namespace

Other Resources

Controlling Projects and Solutions