문제

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.

도움이 되었습니까?

해결책

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;
}

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top