ProjectItems.AddFromDirectory 메서드

디렉터리에서 하나 이상의 ProjectItem 개체를 ProjectItems 컬렉션에 추가합니다.

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

구문

‘선언
Function AddFromDirectory ( _
    Directory As String _
) As ProjectItem
ProjectItem AddFromDirectory(
    string Directory
)
ProjectItem^ AddFromDirectory(
    [InAttribute] String^ Directory
)
abstract AddFromDirectory : 
        Directory:string -> ProjectItem
function AddFromDirectory(
    Directory : String
) : ProjectItem

매개 변수

  • Directory
    형식: String

    필수입니다. 추가할 프로젝트 항목을 가져올 디렉터리입니다.

반환 값

형식: EnvDTE.ProjectItem
ProjectItem 개체

설명

AddFromDirectory는 지정된 디렉터리 및 하위 디렉터리를 차례대로 이동하면서 모든 항목을 자동으로 프로젝트에 추가하므로 이 메서드를 사용하면 항목 추가 작업을 여러 번 수행할 필요가 없습니다.

예제

이 예제는 Visual Studio .NET 2003에서만 작동합니다. 자세한 내용은 Migrating Code that Creates Projects by Using Templates을 참조하십시오.

Sub AddFromDirectoryExample()
   ' This function creates a solution and adds a Visual Basic Console
   ' project to it. 
   Dim soln As Solution
   Dim proj As Project
   Dim projitems As ProjectItems

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

   ' Create a new solution.
   soln.Create("c:\temp2", "MyNewSolution")

   ' Create a new Visual Basic Console application project.
   ' Adjust the save path as needed.
   proj = soln.AddFromTemplate("C:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards\ConsoleApplication\Templates\1033\ConsoleApplication.vbproj", "c:\temp2", "My New Project", True)
   projitems = proj.ProjectItems

   ' Add all of the items in the specified directory (and subdirectories) 
   ' to the project.
   projitems.AddFromDirectory("C:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards\ConsoleApplication\Templates\1033")
End Sub

.NET Framework 보안

참고 항목

참조

ProjectItems 인터페이스

EnvDTE 네임스페이스

기타 리소스

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