Método ProjectItems.AddFromFileCopy

Copia um arquivo de origem e o adiciona ao projeto.

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

Sintaxe

'Declaração
Function AddFromFileCopy ( _
    FilePath As String _
) As ProjectItem
ProjectItem AddFromFileCopy(
    string FilePath
)
ProjectItem^ AddFromFileCopy(
    String^ FilePath
)
abstract AddFromFileCopy : 
        FilePath:string -> ProjectItem 
function AddFromFileCopy(
    FilePath : String
) : ProjectItem

Parâmetros

  • FilePath
    Tipo: System.String
    Obrigatório.O caminho e o nome do item de projeto a ser adicionado.

Valor de retorno

Tipo: EnvDTE.ProjectItem
A ProjectItem objeto.

Comentários

AddFromFileCopyAdiciona um item de projeto a partir de um arquivo que já está instalado na estrutura de diretório do projeto ou copia textual, se necessário, mova-o para o diretório do projeto. AddFromFileCopydifere do AddFromFile porque ele não adiciona um link, e ele difere do AddFromTemplate não necessariamente copiá-lo ou aplicar um modelo.

Exemplos

Este exemplo funciona apenas em Visual Studio.NET 2003. Para obter mais informações, consulte How to: Migrate Code that Creates Projects by Using Templates.

Sub AddFromFileExample()
   ' 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 VB 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 a project item from a file.
   projitems.AddFromFileCopy("C:\temp\somefile.bas")
End Sub

Segurança do .NET Framework

Consulte também

Referência

ProjectItems Interface

Namespace EnvDTE

Outros recursos

Como: compilar e Executar a automação de exemplos de Código do modelo de objeto