Delete an Item from a Project

 < Free Open Study > 

Add an Item to a Project

You can add an item to a project through the use of the AddFromFile method of the ProjectItems object. The following code snippet creates a solution, adds aVisual Basic console application, and finally adds a file to the project:

    ' This function creates a solution and adds a Visual    ' Basic .NET Console    ' project to it.    Dim sln As Solution    Dim prj As Project    Dim prjitems As ProjectItems    ' Create a reference to the solution.    sln = DTE.Solution    ' Create a new solution.    sln.Create("c:\temp2", "TestSolution")    ' Create a new VB Console application project.    ' Adjust the save path as    ' needed.    prj = sln.AddFromTemplate(        "C:\Program Files\Microsoft Visual Studio        .NET\Vb7\VBWizards\ConsoleApplication\Templates\1033\       ConsoleApplication.vbproj", "c:\temp2", "TestProjectt", True)    prjitems = prj.ProjectItems    ' Add a project item from a file.    Prjitems.AddFromFile("C:\temp\Test.bas")

 < Free Open Study > 

Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith © 2008-2017.
If you may any questions please contact us: