CompuMaster.Text.Diff
2025.12.29
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6
This package targets .NET Framework 4.6. The package is compatible with this framework or higher.
dotnet add package CompuMaster.Text.Diff --version 2025.12.29
NuGet\Install-Package CompuMaster.Text.Diff -Version 2025.12.29
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CompuMaster.Text.Diff" Version="2025.12.29" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CompuMaster.Text.Diff" Version="2025.12.29" />
<PackageReference Include="CompuMaster.Text.Diff" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CompuMaster.Text.Diff --version 2025.12.29
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CompuMaster.Text.Diff, 2025.12.29"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CompuMaster.Text.Diff@2025.12.29
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CompuMaster.Text.Diff&version=2025.12.29
#tool nuget:?package=CompuMaster.Text.Diff&version=2025.12.29
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CompuMaster.Text.Diff
Quickly dump a nicely formatted diff output to System.Console or to HTML
Create quickly a colored diff-output to the system console

Create quickly a colored diff-output to HTML

Sample code
This is the full code to create above samples:
C#
using System;
using System.Diagnostics;
using System.IO;
static class SampleMain
{
public static void Main()
{
const string text1 = "This is a demo\nThis is a test of the diff implementation, with some text that is deleted.\n\n\t- a 1st bullet point\n\t- a 2nd bullet point\n\n\0End of diff demo.";
const string text2 = "This is a demo\nThis is another test of the same implementation, with some more text.\n\n\t- a 1st bullet point\n\t- a 2nd bullet point\n\nEnd of diff demo.";
Console.WriteLine("==== Diff2Console ====");
CompuMaster.Text.Diffs.DumpDiffToConsole(text1, text2);
Console.WriteLine();
Console.WriteLine("==== Diff2Console+HumanFriendlyControlChars ====");
CompuMaster.Text.Diffs.DumpDiffToConsole(text1, text2, true);
Console.WriteLine();
Console.WriteLine("==== Diff2ConsoleShort+HumanFriendlyControlChars ====");
CompuMaster.Text.Diffs.DumpDiffToConsoleShort(text1, text2, true);
Console.WriteLine();
Console.WriteLine("==== Diff2Html (Input as Text) ====");
string Text2HtmlOut = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.TextInputToBeEncodedIntoHtmlBeforeOutput);
Console.WriteLine(Text2HtmlOut);
Console.WriteLine();
Console.WriteLine("==== Diff2Html (Input as Html) ====");
string Html2HtmlOut = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.HtmlInputWithoutRequirementOfEncodingBeforeOutput);
Console.WriteLine(Html2HtmlOut);
Console.WriteLine();
Console.WriteLine("==== Diff2Html+HumanFriendlyControlChars (Input as Text) ====");
string Text2HtmlOutHumanFriendly = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.TextInputToBeEncodedIntoHtmlBeforeOutput, true);
Console.WriteLine(Text2HtmlOutHumanFriendly);
Console.WriteLine();
Console.WriteLine("==== Diff2Html+HumanFriendlyControlChars (Input as Html) ====");
string Html2HtmlOutHumanFriendly = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.HtmlInputWithoutRequirementOfEncodingBeforeOutput, true);
Console.WriteLine(Html2HtmlOutHumanFriendly);
Console.WriteLine();
string TempHtmlFile = Path.GetTempFileName() + ".html";
File.WriteAllText(TempHtmlFile, "<h1>Diff2Html (Input as Text)</h1>" + Text2HtmlOut + "<h1>Diff2Html (Input as Html)</h1>" + Html2HtmlOut + "<h1>Diff2Html+HumanFriendlyControlChars (Input as Text)</h1>" + Text2HtmlOutHumanFriendly + "<h1>Diff2Html+HumanFriendlyControlChars (Input as Html)</h1>" + Html2HtmlOutHumanFriendly);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(TempHtmlFile) { UseShellExecute = true });
}
}
VB.NET
Module SampleMain
Sub Main()
Const text1 As String = "This is a demo" & vbNewLine & "This is a test of the diff implementation, with some text that is deleted." & vbNewLine & vbNewLine & vbTab & "- a 1st bullet point" & vbNewLine & vbTab & "- a 2nd bullet point" & vbNewLine & vbNewLine & vbTab & ControlChars.NullChar & "End of diff demo."
Const text2 As String = "This is a demo" & vbNewLine & "This is another test of the same implementation, with some more text." & vbNewLine & vbNewLine & vbTab & "- a 1st bullet point" & vbNewLine & vbTab & "- a 2nd bullet point" & vbNewLine & vbNewLine & "End of diff demo."
Console.WriteLine("==== Diff2Console ====")
CompuMaster.Text.Diffs.DumpDiffToConsole(text1, text2)
Console.WriteLine()
Console.WriteLine("==== Diff2Console+HumanFriendlyControlChars ====")
CompuMaster.Text.Diffs.DumpDiffToConsole(text1, text2, True)
Console.WriteLine()
Console.WriteLine("==== Diff2ConsoleShort+HumanFriendlyControlChars ====")
CompuMaster.Text.Diffs.DumpDiffToConsoleShort(text1, text2, True)
Console.WriteLine()
Console.WriteLine("==== Diff2Html (Input as Text) ====")
Dim Text2HtmlOut As String = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.TextInputToBeEncodedIntoHtmlBeforeOutput)
Console.WriteLine(Text2HtmlOut)
Console.WriteLine()
Console.WriteLine("==== Diff2Html (Input as Html) ====")
Dim Html2HtmlOut As String = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.HtmlInputWithoutRequirementOfEncodingBeforeOutput)
Console.WriteLine(Html2HtmlOut)
Console.WriteLine()
Console.WriteLine("==== Diff2Html+HumanFriendlyControlChars (Input as Text) ====")
Dim Text2HtmlOutHumanFriendly As String = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.TextInputToBeEncodedIntoHtmlBeforeOutput, True)
Console.WriteLine(Text2HtmlOutHumanFriendly)
Console.WriteLine()
Console.WriteLine("==== Diff2Html+HumanFriendlyControlChars (Input as Html) ====")
Dim Html2HtmlOutHumanFriendly As String = CompuMaster.Text.Diffs.DumpDiffAsHtml(text1, text2, CompuMaster.Text.Diffs.EncodingRequirement.HtmlInputWithoutRequirementOfEncodingBeforeOutput, True)
Console.WriteLine(Html2HtmlOutHumanFriendly)
Console.WriteLine()
Dim TempHtmlFile As String = System.IO.Path.GetTempFileName & ".html"
System.IO.File.WriteAllText(TempHtmlFile, "<h1>Diff2Html (Input as Text)</h1>" & Text2HtmlOut & "<h1>Diff2Html (Input as Html)</h1>" & Html2HtmlOut & "<h1>Diff2Html+HumanFriendlyControlChars (Input as Text)</h1>" & Text2HtmlOutHumanFriendly & "<h1>Diff2Html+HumanFriendlyControlChars (Input as Html)</h1>" & Html2HtmlOutHumanFriendly)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(TempHtmlFile) With {.UseShellExecute = True})
End Sub
End Module
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6
- CompuMaster.VisualBasicCompatibility (>= 1.0.6)
- difflib (>= 2017.7.26.1241)
-
.NETStandard 2.0
- CompuMaster.VisualBasicCompatibility (>= 1.0.6)
- difflib (>= 2017.7.26.1241)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2025.12.29 | 117 | 12/29/2025 |
| 2024.11.4.100 | 445 | 12/4/2024 |
| 2022.3.25.102 | 1,726 | 3/25/2022 |
| 2021.1.28.100 | 832 | 1/27/2021 |
| 2021.1.27.100 | 541 | 1/27/2021 |
| 2020.7.24.100 | 623 | 7/24/2020 |
| 2019.7.22.100 | 777 | 7/22/2019 |
| 2017.5.3.100 | 720 | 7/22/2019 |