Export (0) Print
Expand All

_Solution.FindProjectItem Method

Locates an item in a project.

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

ProjectItem FindProjectItem(
	string FileName
)

Parameters

FileName
Type: System.String

Required. The name of the project item.

Return Value

Type: EnvDTE.ProjectItem
A ProjectItem object.

FindProjectItem performs an ItemOperations.OpenFile type search for the given file name. The first project found to have the item returns its ProjectItem object for the name. If the file is not found in the solution, null is returned.

Sub CreateExample()
   ' Open a solution before running this example.
   Dim soln As Solution

   ' Create a reference to the solution.
   soln = DTE.Solution

   ' Find the specified project.
   soln.FindProjectItem("c:\temp\someproj.vbproj")
End Sub

Show:
© 2014 Microsoft