Running de4dot by hand works well for one file, but teams that build and test often need a check that runs the same way every time. This guide shows how to use de4dot in a CI pipeline for automated checks, so a protected build can be cleaned, inspected, and tested without manual steps or surprises.
A CI pipeline is simply a set of steps that run automatically when code is committed or a build is created. Adding de4dot to that flow makes deobfuscation part of quality control, rather than a task someone remembers to do later.
What a de4dot CI Check Should Do
A good automated check does three things. First, it runs de4dot on a test build in a clean environment. Second, it confirms the cleaned file can be opened and inspected. Third, it fails the build clearly when something is wrong, so the team notices before the problem reaches users.
It should not replace human review. De4dot can tell you whether cleaning worked, but it cannot decide whether the recovered code is correct for your product. Treat the pipeline as an early warning system, not a final judgement.
Before You Automate Anything
Start with a manual run that you trust. If de4dot does not clean your build reliably on your own machine, it will not become reliable just because a server runs it. Confirm the detection result, the cleaned output, and the test steps first.
- Use a test build, not a production release, for your first pipeline runs.
- Keep the original protected file as a pipeline artifact for comparison.
- Run the pipeline on a runner you control, with no secrets in the test files.
- Only process code your team owns or has permission to analyse.
- Set a time limit so a stuck cleaning job does not block every build.
Step 1: Prepare the Pipeline Workspace
Your pipeline should start from a fresh workspace, download or build the .NET assembly, and place de4dot where the next step can find it. If you need setup help, read the guide to installing de4dot on Windows and adapt the same idea to your runner, whether it runs Windows, Linux, or a container.
Keep de4dot and your test files in separate folders. That separation makes logs easier to read and makes it clear which file is the input and which is the cleaned output.
Step 2: Detect, Then Clean
Run detection first, then cleaning, as two separate steps if your pipeline tool allows it. Detection gives you a log line you can search for later, and cleaning gives you the file to test.
de4dot -d app.exe
de4dot app.exe
Save both outputs as logs. When a build fails weeks later, those logs are often the fastest way to tell whether the protection changed, a dependency moved, or de4dot itself behaved differently.
Step 3: Check the Cleaned Assembly Automatically
After cleaning, add a simple verification step. At minimum, confirm that the cleaned file exists, that its size is reasonable, and that it can be loaded by your inspection tool. A file that is empty, missing, or unreadable should fail the check immediately.
You can also compare file names and locations with the guide to batch processing files with de4dot if your pipeline handles more than one assembly. Batch logic helps when a release contains several DLLs, but start with one file until the pipeline is stable.
Step 4: Run Your Own Tests on the Cleaned Build
Cleaning alone does not prove the program works. Run your existing unit tests or a smoke test against the cleaned build where possible, and keep untrusted samples in an isolated runner. If the cleaned build crashes, check dependencies first, because a missing DLL is a common cause and is easy to fix in a pipeline script.
Do not let the pipeline run a cleaned program that you do not trust on a shared build agent. Isolation matters just as much in automation as it does on a personal machine.
Handling Failures Without Blocking Every Build
At first, make the de4dot step report a warning rather than failing the whole build, while you learn how often it succeeds. Once the step is stable, switch it to a hard failure for the cases that matter, such as a missing cleaned file or a load error. That gradual approach avoids alert fatigue, where teams start ignoring a check because it fails too often for unclear reasons.
Keep a short runbook next to the pipeline definition. It should say what the step does, where its logs live, and what to try first when it fails. A check without a runbook quickly becomes a check nobody trusts.
Frequently Asked Questions
Can de4dot run in any CI system?
Yes, in principle, if the runner can run de4dot and your build tools. The exact script depends on your CI system, but the steps of detect, clean, verify, and test stay the same.
Should the pipeline clean production files?
No, start with test builds. Only expand to release builds once the check is stable, logged, and reviewed by your team.
What should happen when de4dot fails in CI?
The pipeline should log the detection output, keep the original file as an artifact, and fail clearly. A silent failure hides the very problem the check was meant to catch.
Is it safe to run de4dot on every commit?
It is safe if you use test builds, isolated runners, and time limits. Avoid running untrusted samples on shared agents or with access to secrets.
Does a passing CI check mean the code is fully deobfuscated?
No. A pass means the cleaned file was produced and could be inspected. Full readability still needs human review, especially for heavily protected files.
Used this way, de4dot in a CI pipeline becomes a repeatable safety net: every build gets the same detection, cleaning, and verification steps, and every failure leaves a log you can actually act on.


