Start with the shipped product, not the Visual Studio solution
A solution may contain test projects, build utilities, internal tools, and libraries that never reach customers. Conversely, a single installer may bundle assemblies built by several projects or teams. The useful starting point is therefore a manifest of the binaries that actually ship.
For each assembly, record its role, its dependencies, whether external code consumes its public API, and whether it participates in reflection, serialization, plugin discovery, or UI resource loading.
This is only an illustrative dependency graph. Your real order should come from the references and runtime loading behavior of your application, not from alphabetic file names or the order in which projects appear in Solution Explorer.
Obfuscation is also a contract-management problem
Renaming private implementation details is generally different from renaming a type or member that another component expects to find by name. Cross-assembly calls, plugins, reflection, configuration, and serialized data can all create name-based dependencies that are not obvious from ordinary compile-time references.
| Boundary or mechanism | What can go wrong | Practical response |
|---|---|---|
| Public API shared by two assemblies | One side expects a name that has changed on the other side. | Apply compatible rules to both sides or keep the shared contract stable. |
| Reflection or plugin discovery | A type or member lookup by string no longer finds its target. | Inventory string-based lookups and preserve names that are part of the runtime contract. |
| JSON/XML or other name-sensitive serialization | Property or type names change and persisted or exchanged data no longer maps as expected. | Use explicit serialization names where appropriate, or exclude contract members from renaming; test real payloads. |
| WPF resources and BAML | Renamed types or resource references fail when the UI and resource-bearing assemblies are treated inconsistently. | Include all relevant assemblies in the protection plan and run UI navigation/resource-loading tests. |
| External integration boundary | A plugin, script, or customer integration depends on a public name. | Keep the documented integration surface stable and protect implementation behind it. |
Choose protection settings per assembly
Uniform settings are easy to maintain, but not every binary has the same risk or compatibility requirements. A licensing component may contain high-value decision logic; a contracts assembly may need stable names; a UI assembly may include framework-specific resource considerations.
- Implementation-heavy libraries: prioritize protection of internal implementation while checking for consumers that rely on names.
- Contracts and DTOs: identify the exact types and members that cross assembly, process, or persisted-data boundaries.
- Licensing and sensitive logic: consider stronger available protection where compatible with runtime behavior and performance requirements.
- Entry-point executable: protect it too, but do not mistake it for the whole product.
Keep each assembly's configuration explicit and version-controlled. Whether your tool uses named profiles, project settings, or separate configuration files, the goal is reproducibility: a release should not depend on somebody remembering a sequence of manual GUI choices.
Make the build order deterministic
Obfuscation is a post-build transformation, and some workflows rewrite output files in place. If one project is transforming a DLL while another project is compiling against or copying that same file, parallel build activity can create file-lock or inconsistent-output problems.
- Build the solution in a clean output directory.
- Identify the dependency order from referenced libraries toward the executable or composition root.
- Apply each assembly's configured protection step in that order, using the obfuscator's supported batch or command-line workflow.
- Write transformed files to a distinct staging directory when possible rather than overwriting files still used by active build steps.
- If the pipeline must rewrite shared outputs in place, serialize those steps and disable conflicting parallel project operations.
- Package only the verified protected outputs.
Keep the pipeline commands and settings specific to the obfuscator version you use. Do not copy a command-line switch from an unrelated product or assume that a successful process exit proves the protected application works.
Test the protected graph as a whole
Individual DLLs can load successfully and still fail when combined. The release test should use the complete protected set, not a mixture of protected files and original build outputs.
- Run unit and integration tests against the protected binaries where feasible.
- Exercise startup, dependency injection, plugin discovery, reflection paths, serialization, and licensing flows.
- For WPF applications, navigate through screens and load resource dictionaries that involve protected assemblies.
- Inspect the installer or deployment directory to confirm that it contains the intended protected versions rather than stale, unprotected build outputs.
- Install and launch the packaged application on a clean machine or VM representative of the customer environment.
- Retain obfuscation logs and rename maps when the tool provides them, with access controls appropriate to the information they contain.
Common release failures
| Symptom | Likely cause to investigate | Next check |
|---|---|---|
MissingMethodException or a type cannot be found | A name used across an assembly boundary changed inconsistently. | Compare the shared contract and the settings applied to both assemblies. |
| Serialization succeeds before obfuscation but fails afterward | Payload mapping depends on renamed members or types. | Check explicit serialization attributes and test representative persisted/exchanged data. |
| Build intermittently reports a locked file | Parallel steps access the same assembly while it is being rewritten. | Separate staging outputs or serialize the transformation stage. |
| The installer works locally but ships an unprotected DLL | Packaging captured an earlier build output. | Make packaging depend on the completed protection-and-validation stage. |
| A WPF screen fails only at runtime | A resource or BAML reference crosses assemblies not covered consistently by the plan. | Test resource loading and UI navigation with the final protected set. |
A release checklist
- Inventory all first-party assemblies distributed with the product.
- Map assembly dependencies and name-sensitive runtime contracts.
- Define and version-control protection settings for each assembly.
- Run protection deterministically in dependency order.
- Verify that the installer contains only the intended release binaries.
- Test the integrated, protected application on a clean environment.
- Archive logs and any rename maps needed for support.
The key shift is to treat obfuscation as part of release engineering rather than as a final button click. The unit of delivery is the working application and its complete set of assemblies, so the unit of verification should be the same.
Frequently asked questions
Should every DLL be obfuscated?
Every shipped first-party assembly containing proprietary implementation deserves consideration. The correct settings depend on its role and on whether its names are consumed externally. Third-party binaries should only be modified and redistributed when their licenses permit it.
Should I rename all public members?
Not blindly. Public visibility alone does not reveal every runtime dependency. Preserve names that form documented APIs or are consumed through reflection, plugins, configuration, or serialization.
Is successful obfuscation enough to ship?
No. It confirms that the transformation completed, not that all cross-assembly calls, resources, and runtime contracts still work. Validate the packaged product.
Does this workflow apply to older .NET Framework applications as well as modern .NET?
The planning principles apply to both. Tool compatibility and framework-specific behavior should be checked against the exact target framework and the documentation for the obfuscator version being used.
This article describes general engineering practices. Validate tool-specific options and compatibility against the current documentation for your chosen obfuscator and target runtime.