Question

Is there a way to "programatically" integrate a diff tool (like WinDiff and WinMerge) with Visual Studio 2010? These files are not the files found at Solution Explorer.

The program would have to search and store in the List the files found from certain directory, and then compare the files with same names recursively.

Was it helpful?

Solution

As far as I can gather, you're looking for the TFS Difference class. Here's an example of how to use it:

string f1 = @"file1.cs";
string f2 = @"f2.cs";

Microsoft.TeamFoundation.VersionControl.Common.DiffOptions options = new Microsoft.TeamFoundation.VersionControl.Common.DiffOptions();
options.Recursive = true;
options.StreamWriter = new System.IO.StreamWriter(Console.OpenStandardOutput());
options.UseThirdPartyTool = true;
options.OutputType = Microsoft.TeamFoundation.VersionControl.Common.DiffOutputType.Unified;            

var diff = Difference.DiffFiles(
            f1, FileType.Detect(f1, null),
            f2, FileType.Detect(f2, null),
            options);

while (diff != null)
{
    // Do whatever it is that you want to do here            
    diff = diff.Next;
}

OTHER TIPS

You may want to take a look whether this extension is what you need: http://visualstudiogallery.msdn.microsoft.com/dace3633-0b51-4629-85d4-c59cdce5bb3b?SRC=Featured

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top