VCFile.AddFile Method

Adds a file to the current project or folder.

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Syntax

'Declaration
Function AddFile ( _
    bstrPath As String _
) As Object
'Usage
Dim instance As VCFile 
Dim bstrPath As String 
Dim returnValue As Object 

returnValue = instance.AddFile(bstrPath)
Object AddFile(
    string bstrPath
)
Object^ AddFile(
    String^ bstrPath
)
function AddFile(
    bstrPath : String
) : Object

Parameters

  • bstrPath
    Type: System.String

    Required. The name of the file to add to the project or folder.

Return Value

Type: System.Object
A VCFile object for the file just added.

Remarks

AddFile behavior on a VCProject object depends on the file's extension. If a file has an extension specified with the Filter property, the file is added to the appropriate folder. Otherwise, the file is placed at the bottom of the Solution Explorer hierarchy.

AddFile on a VCFilter object causes the file to be placed in the specified folder, regardless of the file's extension.

Adding a file in this way does not create the file on disk. The caller is responsible for handling that, if necessary.

AddFile on a VCFile object specifies the name of a file to associate with the file.

.NET Framework Security

See Also

Reference

VCFile Interface

VCFile Members

Microsoft.VisualStudio.VCProjectEngine Namespace