DiffEngine
Manages launching and cleanup of diff tools
Install / Use
/learn @VerifyTests/DiffEngineREADME
<img src="/src/icon.png" height="30px"> DiffEngine
DiffEngine manages launching and cleanup of diff tools. It is designed to be used by any Snapshot/Approval testing library.<!-- singleLineInclude: intro. path: /docs/mdsource/intro.include.md -->
See Milestones for release notes.
Currently used by:
Sponsors
Entity Framework Extensions<!-- include: sponsors. path: /docs/mdsource/sponsors.include.md -->
Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.
Developed using JetBrains IDEs
<!-- toc -->Contents
- NuGet
- Supported Tools
- Launching a tool
- Closing a tool
- File type detection
- BuildServerDetector
- AiCliDetector
- Disable for a machine/process
- Disable in code
- Icons<!-- endToc -->
- Tools<!-- include: doc-index. path: /docs/mdsource/doc-index.include.md -->
- Tool Order
- Custom Tool
- DiffEngineTray
- Code versus machine level settings<!-- endInclude -->
NuGet
- https://nuget.org/packages/DiffEngine/
Supported Tools
- AraxisMerge Windows/OSX (Cost: Paid)<!-- include: diffToolList. path: /src/DiffEngine.Tests/diffToolList.include.md -->
- BeyondCompare Windows/OSX/Linux (Cost: Paid)
- Cursor Windows/OSX/Linux (Cost: Free and Paid)
- DeltaWalker Windows/OSX (Cost: Paid)
- Diffinity Windows (Cost: Free with option to donate)
- ExamDiff Windows (Cost: Paid)
- Guiffy Windows/OSX (Cost: Paid)
- Kaleidoscope OSX (Cost: Paid)
- KDiff3 Windows/OSX (Cost: Free)
- Meld Windows/OSX/Linux (Cost: Free)
- MsExcelDiff Windows (Cost: Requires Excel installed)
- MsWordDiff Windows (Cost: Requires Word installed)
- Neovim Windows/OSX/Linux (Cost: Free with option to sponsor)
- P4Merge Windows/OSX/Linux (Cost: Free)
- Rider Windows/OSX/Linux (Cost: Paid with free option for OSS)
- SublimeMerge Windows/OSX/Linux (Cost: Paid)
- TkDiff OSX (Cost: Free)
- TortoiseGitIDiff Windows (Cost: Free)
- TortoiseGitMerge Windows (Cost: Free)
- TortoiseIDiff Windows (Cost: Free)
- TortoiseMerge Windows (Cost: Free)
- Vim Windows/OSX (Cost: Free with option to donate)
- VisualStudio Windows (Cost: Paid and free options)
- VisualStudioCode Windows/OSX/Linux (Cost: Free)
- WinMerge Windows (Cost: Free with option to donate)<!-- endInclude -->
Launching a tool
A tool can be launched using the following:
<!-- snippet: DiffRunnerLaunch --><a id='snippet-DiffRunnerLaunch'></a>
await DiffRunner.LaunchAsync(tempFile, targetFile);
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L68-L72' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Note that this method will respect the above difference behavior in terms of Auto refresh and MDI behaviors.
Closing a tool
A tool can be closed using the following:
<!-- snippet: DiffRunnerKill --><a id='snippet-DiffRunnerKill'></a>
DiffRunner.Kill(file1, file2);
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L82-L86' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerKill' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Note that this method will respect the above difference behavior in terms of MDI behavior.
File type detection
DiffEngine use EmptyFiles to determine if a given file or extension is a binary or text. Custom extensions can be added, or existing ones changed.
BuildServerDetector
BuildServerDetector.Detected returns true if the current code is running on a build/CI server.
Supports:
There are also individual properties to check for each specific build system
<!-- snippet: BuildServerDetectorProps --><a id='snippet-BuildServerDetectorProps'></a>
var isWsl = BuildServerDetector.IsWsl;
var isTravis = BuildServerDetector.IsTravis;
var isJenkins = BuildServerDetector.IsJenkins;
var isGithubAction = BuildServerDetector.IsGithubAction;
var isAzureDevops = BuildServerDetector.IsAzureDevops;
var isTeamCity = BuildServerDetector.IsTeamCity;
var isGitLab = BuildServerDetector.IsGitLab;
var isMyGet = BuildServerDetector.IsMyGet;
var isGoDc = BuildServerDetector.IsGoDc;
var isDocker = BuildServerDetector.IsDocker;
var isAppVeyor = BuildServerDetector.IsAppVeyor;
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L8-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorProps' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Override in tests
BuildServerDetector.Detected can be set at test time. The value is stored in an AsyncLocal, so it is scoped to the current async context and does not leak to other threads or tests running in parallel.
<a id='snippet-BuildServerDetectorDetectedOverride'></a>
[Test]
public async Task SetDetectedPersistsInAsyncContext()
{
var original = BuildServerDetector.Detected;
try
{
BuildServerDetector.Detected = true;
await Assert.That(BuildServerDetector.Detected).IsTrue();
await Task.Delay(1);
await Assert.That(BuildServerDetector.Detected).IsTrue();
}
finally
{
BuildServerDetector.Detected = original;
}
}
[Test]
public async Task SetDetectedDoesNotLeakToOtherContexts()
{
var parentValue = BuildServerDetector.Detected;
await Task.Run(async () =>
{
BuildServerDetector.Detected = true;
await Assert.That(BuildServerDetector.Detected).IsTrue();
});
await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
}
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L27-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorDetectedOverride' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->AiCliDetector
AiCliDetector.Detected returns true if the current code is running in an AI-powered CLI environment.
Supports:
- [GitHub Copilot CLI](https://docs.github.com/en
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

