VersionControlPath.Combine Method (String, String, String)
Given a base local path, base server path and target local path computes the target server path. This is completed by generating the relative path for the local paths, converting that to a server relative path and combining it with the base server path.
Note: This method will throw an invalid path exception if it cannot generate the target server path. Possible reasons for this include the following:
1) local paths are on different drives and are not relative.
2) combining the calculated relative path with the base server path causes a "negative folder depth" (that is directory above root, $/).
Examples: Combine(@"c:\myproj\abc\xyz", @"c:\\myproj\\abc\\blech", @"$/abc") -> @"$/blech" Combine(@"c:\myproj\abc\xyz", @"c:\\myproj\\abc\\xyz\\x", @"$/xyz") -> @"$/xyz/x" Combine(@"c:\myproj\abc\xyz", @"c:\\yourproj\\abc\\xyz\\x", @"$/xyz") -> @"InvalidPathException" Combine(@"c:\myproj\abc\xyz", @"c:\\yourproj\\abc\\xyz", @"$/myproj/abc/xyz") -> @"$/yourproj/abc/xyz"
Namespace: Microsoft.TeamFoundation.VersionControl.Common
Assembly: Microsoft.TeamFoundation.VersionControl.Common (in Microsoft.TeamFoundation.VersionControl.Common.dll)
Syntax
'Declaration
Public Shared Function Combine ( _
baseLocalPath As String, _
targetLocalPath As String, _
baseServerPath As String _
) As String
public static string Combine(
string baseLocalPath,
string targetLocalPath,
string baseServerPath
)
public:
static String^ Combine(
String^ baseLocalPath,
String^ targetLocalPath,
String^ baseServerPath
)
static member Combine :
baseLocalPath:string *
targetLocalPath:string *
baseServerPath:string -> string
public static function Combine(
baseLocalPath : String,
targetLocalPath : String,
baseServerPath : String
) : String
Parameters
baseLocalPath
Type: System.StringSource item's local path.
targetLocalPath
Type: System.StringTarget item's local path.
baseServerPath
Type: System.StringSource item's server path.
Return Value
Type: System.String
Target item's absolute server path.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.