Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can use the Difference.DiffFiles method which compares two files using the internal diff engine, and return the linked list of DiffSegments:
DiffSegment ds = Difference.DiffFiles(fileA, FileType.Detect(fileA, null), fileB, FileType.Detect(fileB, null), new DiffOptions());
Console.WriteLine(ds.Next == null ? "Identical" : "Different");
// If you don’t have the files locally on disk, you’ll need to download them first:
// The path can be a temp file:
// Path.Combine(Environment.GetEnvironmentVariable("tmp"), "diff_" + someRandomValue);
string fileA = "Local path for file A";
string fileB = "Local path for file B";
VersionControlServer vcs = new TeamFoundationServer("https://tfs:8080").GetService(typeof(VersionControlServer));
vcs.DownloadFile("$/Proj/a", fileA);
vcs.DownloadFile("$/Proj/b", fileB);