Aracılığıyla paylaş


ProjectItems.AddFromDirectory Yöntem

Bir veya daha fazla ekler ProjectItem bir dizin nesneleri ProjectItems koleksiyonu.

Ad alanı:  EnvDTE
Derleme:  EnvDTE (EnvDTE.dll içinde)

Sözdizimi

'Bildirim
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

Parametreler

  • Directory
    Tür: String

    Gerekli.Proje öğesi eklemek, dizin.

Dönüş Değeri

Tür: EnvDTE.ProjectItem
ProjectItem nesnesi

Notlar

AddFromDirectoryMadde işlemleri ile verilen dizin ve alt dizinlerinden otomatik olarak tüm öğeleri birden fazla yapmak zorunda kaydetme proje ekleme adımları ekleyin.

Örnekler

Bu örnek, yalnızca Visual Studio ile çalışır.NET 2003.Daha fazla bilgi için bkz. 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 Güvenliği

Ayrıca bkz.

Başvuru

ProjectItems Arabirim

EnvDTE Ad Alanı

Diğer Kaynaklar

Nasıl yapılır: Otomasyon Nesne Modeli Kod Örnekleri Derleme ve Çalıştırma