Signing and obfuscation both touch the finished assembly, so the order you do them in is not a style choice — get it wrong and your build ships with a broken signature or fails to load. The rule is short: build, obfuscate, then sign — signing last. Here is why, and how to make it routine.
Why order matters
A signature is a cryptographic hash of the exact bytes of your assembly. Obfuscation rewrites those bytes — it renames metadata and, on Pro, restructures method bodies. Any signature applied before that no longer matches the file it is supposed to vouch for. So a signature has to be the last thing that happens to the binary, after every tool that modifies it has run.
This is the single most common signing mistake with obfuscation: signing the build output, then obfuscating it, and shipping an assembly whose signature is now invalid. Flip the two.
Authenticode (the publisher signature)
Authenticode is the signature Windows and SmartScreen check to show who published an
.exe or .dll and that it has not been altered since. Because
obfuscation alters the file, sign the obfuscated output:
- Build in Release.
- Obfuscate the assembly.
- Run
signtool sign(with a timestamp) on the obfuscated file, as the last step before packaging.
Reputation with SmartScreen accrues to the signed bytes, so re-signing on every release with the same certificate is what lets a new build inherit your standing rather than starting cold. A brand-new binary can still be flagged on low reputation alone — the antivirus false-positives guide covers why, and why signing last is the durable fix.
Strong naming (the assembly identity)
Strong naming is different from Authenticode: it is part of a .NET assembly's
identity — the public-key token other assemblies reference it by — not a
publisher stamp. Rewriting the assembly invalidates its strong-name signature too, and a
mismatched one is worse than a missing publisher signature: the runtime can refuse to
load the assembly with a FileLoadException or strong-name verification
error.
The fix is the same shape — re-sign after obfuscating — with one practical pattern for build pipelines:
- Re-sign with the same key. Signing the obfuscated assembly with your original key file keeps the public-key token identical, so anything that references it by strong name still binds. Only the signature over the new bytes changes.
- Or delay-sign, then sign last. Build delay-signed (public key
embedded, signature deferred), obfuscate, then complete the strong-name signature on
the obfuscated output. Many obfuscation workflows re-sign for you when given the key;
otherwise finish it with
sn -Ras the final managed step, before Authenticode.
When both apply, the full order is: build → obfuscate → strong-name sign → Authenticode sign.
The .NET Core launcher trap
On .NET Core and .NET 5+, the YourApp.exe beside your build is a native
launcher with no managed code; your assembly is the same-named .dll. Obfuscate
and strong-name the .dll — see
why that is the file that matters. You can
still Authenticode-sign the .exe launcher for the publisher stamp users see,
but the managed protection and identity belong to the .dll.
Fitting it into a build
In a pipeline the sequence is just three ordered steps: produce the Release build, obfuscate it (locally or via the API), then sign the result. Keep signing as a distinct final stage so nothing runs after it. The CI/CD guide has ready-made obfuscation steps for GitHub Actions and Azure Pipelines that you place immediately before your existing signing step.
One last habit: archive the original, unobfuscated build and its symbols for every release. You will want them to decode a crash stack trace later, and signing the shipped copy does nothing to help you read its obfuscated traces.