A cleaned assembly that looks readable in a decompiler can still fail when you try to run it. That failure is often strong-name validation, and it can feel confusing because the code itself may look correct. This guide explains how to fix strong name validation after de4dot cleaning in a careful, step-by-step way, without guessing and without changing files you do not own.
Work only on files you own or have clear permission to examine, and keep the original file untouched in a separate folder. Cleaning, testing, and signing are separate steps, and each one needs its own check. If you skip the checks, you can spend a long time fixing the wrong problem, because a missing dependency, a changed reference, and a failed signature can all produce a load error.
Before you begin, check the de4dot supported obfuscators list to confirm the cleaning context for the file you are working with. That context helps you judge whether the cleaned output is the result you expected before you turn to signing and validation.
What Strong-Name Validation Means
A strong name gives a .NET assembly an identity that is stronger than a file name. It is based on the simple name of the assembly, its version, its culture, and a public key token derived from the public key used to sign it. When an assembly is signed, a signature is stored with the file, and the runtime can check that the contents still match that signature.
Strong-name validation is the check that the file has not changed since it was signed. If the contents no longer match the signature, the runtime may refuse to load the assembly. That refusal is a safety and identity check, not a judgment about whether the code is readable or whether de4dot recovered the logic well. A file can be useful for analysis and still fail validation when it is loaded as a signed assembly.
- Simple name, such as the assembly name shown in a decompiler or in assembly properties.
- Version number, which must match what a referencing assembly expects unless a binding redirect or a rebuild changes that expectation.
- Culture, which is usually neutral for code assemblies.
- Public key token, which identifies the key used to sign the assembly and is part of references from other assemblies.
Keep those four parts together when you compare the original and the cleaned file. A change in any one of them can explain a load failure, even when the validation message is the first error you see.
Why Cleaning Can Break Validation
Cleaning changes the bytes of an assembly. Deobfuscation can restore names, decrypt strings, repair control flow, and change metadata, and each of those changes means the cleaned file is no longer byte-for-byte identical to the signed original. The original signature was calculated over the original bytes, so it does not automatically apply to the cleaned bytes. That is the central point to understand, and it does not mean the cleaning step was wrong.
Do not assume that a validation failure proves the code was damaged. It proves only that the signature and the current contents do not agree in the way the runtime expects. You still need to review the cleaned output, test it in isolation, and check its references before you decide whether the file is usable for your own lawful purpose.
For a related cleaning workflow, see how to clean DeepSea obfuscated files with de4dot. The preparation, detection, and review steps there are close to the steps used here, even though the problem in this guide is signing and validation rather than obfuscation alone.
Step 1: Confirm the Error Is Strong-Name Validation
Start with the exact error message, not with a general fix. Copy the full message, including the exception type, the assembly name, and any error code, and keep it with your notes. A strong-name problem often appears as a load failure that names the assembly and says that strong-name validation failed, but a similar message can also appear when a file is missing, a version does not match, or a dependency cannot be found.
- Note whether the error names the cleaned assembly itself or a referenced assembly, because the fix depends on which file failed.
- Note whether the original file loads in the same test folder, where it is safe to run it, so you can tell whether the problem began with cleaning or was already present.
- Note the runtime and the folder used for the test, including whether the file was loaded from a local folder, a network location, or the Global Assembly Cache.
- Keep the original file untouched, and test only a copy, so you can repeat the comparison cleanly.
If the message does not mention a strong name, treat the problem as a general load or dependency problem first. Fixing a signature will not help if the real cause is a missing library, a wrong version, or a file in the wrong folder.
Step 2: Check the Assembly Identity and Signature Status
Compare the identity of the original and cleaned assemblies side by side. Open both in a decompiler or an assembly inspection tool where you can read the name, version, culture, and public key token, and record what you find. If the public key token is missing from the cleaned file, or if it differs from the original, that difference matters for every assembly that references the cleaned file.
Where the .NET Framework SDK tools are available, you can also check the file from the command line. The command sn -T yourfile.dll shows the public key token, and the command sn -vf yourfile.dll forces a verification check. Use those results as evidence, not as a fix on their own, and record the output alongside the error message from Step 1.
Check whether the cleaned assembly still claims to be strong-named at all. An assembly can be signed, delay-signed, or unsigned, and each state needs a different next step. A delay-signed assembly is one that was built with a public key but without the private key, so it cannot pass full validation until it is fully signed. If you see signs of delay signing in your own build, the fix belongs in your build and signing process, not in a manual edit to the cleaned file.
Step 3: Test the Cleaned File in Isolation on the Target Runtime
Test the cleaned file in a separate folder, in an isolated environment where it is safe to run, and keep its libraries together with it. Do not test an untrusted file on a production machine, and do not replace a working assembly until the cleaned version has passed the same checks in isolation. A short, repeatable test gives you a clear result that you can compare with the original file.
- Place the cleaned file and its dependencies together in the test folder, and keep the original file in a different folder.
- Run the cleaned file once, and note whether it starts, what it shows, and whether any error names a missing assembly or a validation failure.
- Repeat the same test with the original file, where it is safe to do so, and compare the behaviour rather than relying on memory.
- Test on the runtime you actually intend to use, because .NET Framework and modern .NET handle strong names differently, as explained below.
Testing is a check, not proof that every part of the file was recovered. A program can start and still have a hidden problem, and a program can fail validation even when its code looks correct. Use the test result together with the identity check from Step 2.
Step 4: Re-Sign the Assembly When You Own It and Hold the Key
Re-signing is the correct fix only when you own the assembly, you hold the signing key, and you have the right to produce a new signed version. In that case, the cleaned file needs a new signature that matches its current contents, because the old signature cannot be reused after the bytes have changed. Do not re-sign a third-party assembly with your own key and present it as the original, and do not use a key you do not own.
Where the Strong Name tool is available, the usual form is sn -R yourfile.dll yourkey.snk, where yourkey.snk is your own key file. That command applies a new signature to the assembly. Keep a backup of the cleaned file before you sign it, keep the key file in a safe place, and record the key and the command you used so the result can be reproduced.
In many cases, the cleaner path is to rebuild from your own source with signing enabled in your project, rather than signing a cleaned binary by hand. A rebuild keeps the signing step inside your normal build process, keeps the version and identity under your control, and avoids a one-off signed file that no one else can reproduce. If you do not have the source or the key, re-signing by hand is not the right answer, and the local analysis approach in the next step is the safer boundary.
After re-signing, test the file again in isolation, and check the public key token. If you signed with a different key from the original, the token will change, and any assembly that references the old token will need to be rebuilt or redirected. That follow-on effect is normal, and it is why the reference check in Step 6 matters.
Step 5: Use Verification Skipping Only for Local Analysis
For local analysis and testing only, the Strong Name tool can register an assembly so that validation is skipped on that machine. The usual form is sn -Vr yourfile.dll, followed later by sn -Vu yourfile.dll to remove the registration. This approach lets you test whether the cleaned code itself works, without claiming that the file is properly signed.
Treat verification skipping as a temporary, local measure. Use it only in an isolated test environment, only for a file you are allowed to examine, and only while you are diagnosing the problem. Remove the registration when you finish, do not rely on it for distribution, and do not ask other people to skip validation so that an unsigned or re-signed file will run. A file that only works because validation was skipped on one machine is not a fixed file.
Record the fact that you skipped verification, the assembly it applied to, and when you removed the registration. That note protects the next person who tests the file, because they will otherwise see different behaviour on a machine where validation is still enforced.
Step 6: Fix References and Dependent Assemblies
A strong-named assembly is rarely used alone. Other assemblies record the name, version, culture, and public key token of each assembly they reference, and the runtime checks those references when it loads the program. If the cleaned or re-signed assembly has a different token or version from the one recorded in a referencing assembly, that referencing assembly can fail to load even when the cleaned file itself passes its own check.
- List the assemblies that reference the cleaned file, and check the version and public key token each one expects.
- Rebuild a referencing assembly from your own source where you own it, so its reference matches the new identity.
- Where a rebuild is not possible, check whether a binding redirect is appropriate for your own application, and test the redirect in isolation before you rely on it.
- Check every dependency in turn, because fixing one reference can reveal the next mismatch.
Do not edit reference metadata by hand unless you understand the effect on every dependent assembly and you are working on your own code. A small change to a version or token can move the failure from one assembly to another, and the error message may then name a different file.
Strong-Name Validation, the Global Assembly Cache, and Trust
The Global Assembly Cache, often called the GAC, is a shared store for strong-named assemblies on .NET Framework. An assembly installed in the GAC must be strong-named, and its identity must be exact, because other programs may rely on that shared copy. A cleaned file whose signature does not validate should not be installed in the GAC as a replacement for a signed assembly, and testing outside the GAC is the safer first step.
Trust and load location can also change the result. In some full-trust .NET Framework scenarios, strong-name validation may be bypassed for an assembly loaded from a local, fully trusted location, so a file can run in one folder and fail in another. Do not treat a local success as proof that the file will work in the GAC, in a partially trusted environment, or on another machine. Test the exact deployment path you intend to use, and keep a note of the folder, the trust level, and the runtime for each test.
Strong-Name Checks in .NET Framework and Modern .NET
Strong-name validation is primarily a .NET Framework concern. Modern .NET, including .NET Core and later versions, does not enforce strong-name validation in the same way when it loads an assembly, and a strong name is mainly an identity for references rather than a load-time signature check. That difference explains why the same cleaned file can behave differently on different runtimes.
Use the target runtime for every test, and do not assume that a result on modern .NET proves the file will load on .NET Framework, or the reverse. If your program must run on .NET Framework, the Framework checks in this guide are the ones that matter. If it runs only on modern .NET, focus on references, versions, and dependencies, and still keep the identity check from Step 2, because a changed token can break a reference even where signature validation is not enforced.
Common Problems and Practical Fixes
If the error says strong-name validation failed
Confirm which assembly failed, compare its identity with the original, and follow Steps 1 to 3 before you change anything. If you own the assembly and hold the key, re-sign it as described in Step 4 and test again. If you do not own it, use local verification skipping only for analysis, as described in Step 5, and do not distribute the result.
If the assembly loads locally but fails elsewhere
Check the load location, the trust level, and whether the failing machine has a verification-skipping registration or a different runtime. Test the same file in the same kind of folder and on the same runtime as the failing environment, and check whether the GAC holds a different version with the same name. A local success that depends on a skipped check is not a fix.
If a re-signed assembly breaks its references
Check the public key token and version of the re-signed file against the references recorded in each dependent assembly. Rebuild the dependent assemblies from your own source where you own them, or use a binding redirect for your own application where that is appropriate, and test each dependency in turn. Do not change the token back by hand, because the token must match the key that signed the file.
If the cleaned file still will not run after re-signing
Read the new error message in full, because the cause may have moved from validation to a missing dependency, a version mismatch, or a problem in the cleaned code itself. Return to the original copy, review the cleaned output in a decompiler, and check the dependencies and the test folder. Re-signing fixes a signature mismatch only, and it cannot repair missing code or a broken reference.
Conclusion
Fixing strong-name validation after de4dot cleaning works best as a measured process: confirm the exact error, check the assembly identity, test in isolation, and then choose the fix that fits your rights in the file. Re-sign when you own the assembly and hold the key, use verification skipping only for temporary local analysis, and fix references so dependent assemblies match the new identity.
Keep your notes, keep the original untouched, and judge each file on its own result. That approach gives you a result you can explain and reproduce, rather than a file that works on one machine for a reason no one can trace.
Frequently Asked Questions
Why does a strong-named assembly fail validation after de4dot cleaning?
Cleaning changes the bytes of the assembly, while the original signature was calculated over the original bytes. When the contents and the signature no longer agree, the runtime may refuse to load the file. The failure shows a signature mismatch, and it does not by itself prove that the recovered code is damaged.
Can I re-sign a cleaned assembly with any key?
No. Re-sign only when you own the assembly and hold the signing key, and only for your own lawful use. Signing a third-party assembly with a different key changes its public key token, breaks references that expect the original token, and must not be presented as the original signed file.
What is verification skipping, and when is it safe to use?
Verification skipping registers an assembly so that strong-name validation is skipped on one machine, usually with the Strong Name tool. It is safe only as a temporary measure for local analysis in an isolated environment. Remove the registration when you finish, and never rely on it for distribution.
Does strong-name validation work the same way on modern .NET?
No. Strong-name validation is primarily a .NET Framework concern, and modern .NET does not enforce it in the same way at load time. A strong name still matters as an identity for references, so a changed public key token can still break a dependent assembly. Always test on the runtime you intend to use.
What should I check first if the cleaned file will not load?
Copy the full error message, confirm which assembly failed, and compare the name, version, culture, and public key token of the original and cleaned files. Test the cleaned file in isolation with its dependencies, and check for a missing library or a version mismatch before you change any signing or reference.


