Project.ProjectItems 속성

Project 개체의 ProjectItems 컬렉션을 가져옵니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
ReadOnly Property ProjectItems As ProjectItems
ProjectItems ProjectItems { get; }
property ProjectItems^ ProjectItems {
    ProjectItems^ get ();
}
abstract ProjectItems : ProjectItems with get
function get ProjectItems () : ProjectItems

속성 값

형식: EnvDTE.ProjectItems
ProjectItems 컬렉션입니다.

설명

반환된 된 컬렉션에서 프로젝트 항목 아래 계층적으로 될 수 있는 프로젝트 항목을 나타냅니다.

예제

이 예제에서는 Visual Studio.NET 2003 및 이후 버전 에서만 작동합니다. 자세한 내용은 방법: 프로그래밍 방식으로 프로젝트 만들기을 참조하십시오.

Sub ProjectItemsExample(ByVal dte As DTE)

    ' NOTE: This example requires a reference to the 
    '       VSLangProj namespace.

    ' Create a new solution.
    Dim soln As Solution = dte.Solution
    Dim solnName As String = "NewSolution.sln"
    Dim tempPath As String = System.IO.Path.GetTempPath()
    soln.Create(tempPath, solnName)

    ' Create a new Visual Basic Console Application project.
    Dim templatePath As String = 
        dte.Solution.TemplatePath(PrjKind.prjKindVBProject)
    templatePath &= "ConsoleApplication.vsz"
    Dim projName As String = "NewProject"
    soln.AddFromTemplate(templatePath, tempPath & projName, projName)
    Dim proj As Project = soln.Item(1)

    ' Add a comment to Module1.vb.
    Dim item As ProjectItem = proj.ProjectItems.Item("Module1.vb")
    Dim sel As TextSelection = CType(item.Document.Selection, 
        TextSelection)

    sel.StartOfDocument()
    sel.NewLine()
    sel.LineUp()
    sel.Text = "' New comment" & vbCrLf

End Sub
public void ProjectItemsExample(DTE dte)
{
    // NOTE: This example requires a reference to the 
    //       VSLangProj namespace.

    // Create a new solution.
    Solution soln = dte.Solution;
    string solnName = "NewSolution.sln";
    string tempPath = System.IO.Path.GetTempPath();
    soln.Create(tempPath, solnName);

    // Create a new C# Console Application project.
    string templatePath = 
        dte.Solution.get_TemplatePath(PrjKind.prjKindCSharpProject);
    templatePath += "CSharpConsole.vsz";
    string projName = "Project1";
    soln.AddFromTemplate(templatePath, tempPath + projName, 
        projName, false);
    Project proj = soln.Item(1);

    // Add a comment to Class1.cs.
    ProjectItem item = proj.ProjectItems.Item("Class1.cs");
    TextSelection sel = (TextSelection)item.Document.Selection;

    sel.StartOfDocument(false);
    sel.NewLine(1);
    sel.LineUp(false, 1);
    sel.Text = "// New comment\n";
}

.NET Framework 보안

참고 항목

참조

Project 인터페이스

EnvDTE 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행