Rustemsoft / .NET Engineering

.NET engineering · Application protection · Release practices

Multi-Assembly .NET Obfuscation: Protect the Boundaries, Not Just the EXE

In a multi-project solution, the hard part is not running an obfuscator on several DLLs. It is preserving the contracts that connect them while making sure the code you ship is the code you actually protected.

Short answer: Map the assemblies your product ships, identify which types and names form runtime contracts, process the protected binaries in dependency order, and validate the entire release as one integrated application. Obfuscating only the startup executable can leave valuable implementation code exposed in sibling DLLs.

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.

ClientApp.exe ├── Product.UI.dll ├── Product.Core.dll │ ├── Product.Data.dll │ └── Product.Contracts.dll └── Product.Licensing.dll

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 mechanismWhat can go wrongPractical response
Public API shared by two assembliesOne 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 discoveryA 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 serializationProperty 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 BAMLRenamed 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 boundaryA plugin, script, or customer integration depends on a public name.Keep the documented integration surface stable and protect implementation behind it.
Useful rule: Treat names as disposable only when you control every place that consumes them. A public member is not automatically an external contract, but a “public” declaration may become one through plugins, reflection, scripts, or customer integrations.

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.

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.

  1. Build the solution in a clean output directory.
  2. Identify the dependency order from referenced libraries toward the executable or composition root.
  3. Apply each assembly's configured protection step in that order, using the obfuscator's supported batch or command-line workflow.
  4. Write transformed files to a distinct staging directory when possible rather than overwriting files still used by active build steps.
  5. If the pipeline must rewrite shared outputs in place, serialize those steps and disable conflicting parallel project operations.
  6. 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.

Common release failures

SymptomLikely cause to investigateNext check
MissingMethodException or a type cannot be foundA 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 afterwardPayload mapping depends on renamed members or types.Check explicit serialization attributes and test representative persisted/exchanged data.
Build intermittently reports a locked fileParallel 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 DLLPackaging captured an earlier build output.Make packaging depend on the completed protection-and-validation stage.
A WPF screen fails only at runtimeA 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

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.