获取或设置相对文件路径。此路径必须相对于项目目录,而且可以包含宏。
命名空间:  Microsoft.VisualStudio.VCProjectEngine
程序集:  Microsoft.VisualStudio.VCProjectEngine(在 Microsoft.VisualStudio.VCProjectEngine.dll 中)
语法
声明
Property RelativePath As String
string RelativePath { get; set; }
property String^ RelativePath {
    String^ get ();
    void set (String^ value);
}
abstract RelativePath : string with get, set
function get RelativePath () : String
function set RelativePath (value : String)
属性值
类型:System.String
文件的相对路径。
备注
任何尝试设置文件的相对路径必须生成与 FullPath 特性一致的路径。有关如何编译和运行此示例的信息,请参见 如何:编译项目模型扩展性示例代码 。
示例
下面的示例在集成开发环境 (ide) 使用 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
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。