VCFile.AddFile(String) 方法

定义

向当前项目或文件夹添加一个文件。

public:
 System::Object ^ AddFile(System::String ^ bstrPath);
public:
 Platform::Object ^ AddFile(Platform::String ^ bstrPath);
winrt::Windows::Foundation::IInspectable AddFile(std::wstring const & bstrPath);
[System.Runtime.InteropServices.DispId(415)]
public object AddFile (string bstrPath);
[<System.Runtime.InteropServices.DispId(415)>]
abstract member AddFile : string -> obj
Public Function AddFile (bstrPath As String) As Object

参数

bstrPath
String

必需。 要向项目或文件夹添加的文件的名称。

返回

Object

VCFile刚添加的文件的对象。

属性

注解

AddFile 对象的行为 VCProject 取决于文件的扩展名。 如果文件具有使用属性指定的扩展名 Filter ,则该文件将添加到相应的文件夹中。 否则,文件位于 解决方案资源管理器 层次结构的底部。

AddFile 对于 VCFilter 对象,无论文件的扩展名如何,都会将文件放在指定的文件夹中。

以这种方式添加文件不会在磁盘上创建文件。 调用方负责根据需要处理该。

AddFile 对象上的 VCFile 指定要与该文件关联的文件的名称。

适用于