共用方式為


ItemOperations.AddExistingItem(String) Method

Definition

Adds an existing item to the current project.

public:
 EnvDTE::ProjectItem ^ AddExistingItem(System::String ^ FileName);
public:
 EnvDTE::ProjectItem ^ AddExistingItem(Platform::String ^ FileName);
EnvDTE::ProjectItem AddExistingItem(std::wstring const & FileName);
[System.Runtime.InteropServices.DispId(6)]
public EnvDTE.ProjectItem AddExistingItem (string FileName);
[<System.Runtime.InteropServices.DispId(6)>]
abstract member AddExistingItem : string -> EnvDTE.ProjectItem
Public Function AddExistingItem (FileName As String) As ProjectItem

Parameters

FileName
String

Required. The full path and file name of the item to be added.

Returns

A ProjectItem object.

Attributes

Examples

Sub AddExistingItemExample()  
   Dim ItemOp As ItemOperations  
   ItemOp = DTE.ItemOperations  
   ' Add a log file to the project.  
   ItemOp.AddExistingItem("d:\windows\ocgen.log")  
End Sub  

Applies to