VCFile.RelativePath 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置文件的相对路径。 此路径必须相对于项目目录,并且可以包含宏。
public:
property System::String ^ RelativePath { System::String ^ get(); void set(System::String ^ value); };
public:
property Platform::String ^ RelativePath { Platform::String ^ get(); void set(Platform::String ^ value); };
[System.Runtime.InteropServices.DispId(402)]
public string RelativePath { [System.Runtime.InteropServices.DispId(402)] get; [System.Runtime.InteropServices.DispId(402)] set; }
[<System.Runtime.InteropServices.DispId(402)>]
[<get: System.Runtime.InteropServices.DispId(402)>]
[<set: System.Runtime.InteropServices.DispId(402)>]
member this.RelativePath : string with get, set
Public Property RelativePath As String
属性值
文件的相对路径。
- 属性
示例
下面的示例使用 RelativePath 集成开发环境中的属性 (IDE) :
' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Public Module Module1
Sub Test()
Dim file As VCFile
Dim col As IVCCollection
Dim idx As Integer
Dim prj As VCProject
prj = DTE.Solution.Projects.Item(1).Object
col = prj.Files
For idx = 1 To col.Count
file = col.Item(idx)
MsgBox(file.RelativePath)
Next
End Sub
End Module
注解
如果尝试设置文件的相对路径,则必须导致路径与 FullPath 属性一致。 有关如何编译和运行此示例的信息,请参阅 如何:编译项目模型扩展性的示例代码 。