Please note that using Path.Combine() might not give you the expected result, e.g:
string path = System.IO.Path.Combine(@"c:\dir1\dir2",
@"..\..\Project2\xml\File.xml");
This results in in the following string:
@"c:\dir1\dir2\dir3\..\..\Project2\xml\File.xml"
If you expect the path to be "c:\dir1\Project2\xml\File.xml", then you might use a method like this one instead of Path.Combine():
public static string CombinePaths(string rootPath, string relativePath)
{
DirectoryInfo dir = new DirectoryInfo(rootPath);
while (relativePath.StartsWith("..\\"))
{
dir = dir.Parent;
relativePath = relativePath.Substring(3);
}
return Path.Combine(dir.FullName, relativePath);
}