Which protection layers do you actually need?

Renaming, string encryption, control-flow, virtualization — a decision guide that matches each layer to the threat it answers, so you turn on what your project needs and nothing it doesn't.

There are six protection layers available here, and the instinct is to turn them all on. Resist it. Each layer answers a specific threat and carries a specific cost, and the right configuration is the smallest one that covers what your code is actually exposed to. This guide walks you from "I just want names hidden" to "this method is the product" and tells you where to stop. It assumes you have already settled the question before it — whether this particular binary is one you ship at all, since code that never leaves your servers gains little from any of this. If you are not sure, start with do you need to obfuscate server-side code?

Start with one question: what are you protecting against?

Obfuscation is not one thing. It raises the cost of reverse engineering, and different layers raise the cost of different kinds of reverse engineering. So before choosing layers, name the threat:

  • Casual decompiling — someone opens your DLL in ILSpy to see how it works, copy a trick, or check what you call things.
  • Harvesting literals — someone runs a strings dump to pull your endpoints, request shapes, feature flags or messages straight out of the file.
  • Tracing your logic — someone reads the decompiled flow of a method to understand or reproduce what it does.
  • Lifting a specific algorithm — your pricing, scoring, licensing or proprietary calculation is the thing of value, and someone wants that exact method.

Most projects face the first two and stop there. A smaller number genuinely face the last. The layers map onto this list almost one to one.

The decision table

Layer Answers Cost Tier
Symbol renaming Casual decompiling None Free
Block ILDasm The casual toolchain None Free
String encryption Harvesting literals Negligible Pro
Control-flow obfuscation Tracing your logic Small Pro
Reference proxying Mapping what you call Small Pro
Method virtualization Lifting a specific algorithm Large, per method Pro

Layer 1 — always: renaming + block ILDasm

These are the free default and there is no project they are wrong for. Renaming strips the names a decompiler leans on — your classes, methods and fields become a, b, c — so a casual read no longer hands over a self-documenting copy of your source. Blocking ILDasm turns away the simplest tooling. Neither costs anything at runtime. If you do nothing else, do this. What it does and does not change is covered in what obfuscation actually protects against, and the mechanics — including what renaming deliberately leaves alone — in how symbol renaming works.

One caveat worth knowing before you ship: renaming breaks anything that looks a member up by its string name — reflection, serialization, DI, XAML. If that is you, read obfuscation and reflection first. This is a free-tier concern as much as a Pro one.

Layer 2 — if your literals are worth reading: string encryption

Open your source and look at the string literals. Are there endpoint URLs, a feature flag, the shape of an API request, telling error messages? Renaming leaves every one of them in plain text in the assembly, readable without even decompiling. If that list is boring, skip this layer. If it maps out how your software works, turn it on — the cost is a function call where you had a constant. The mechanism and its one honest limit (the decoder ships in the binary) are in how string encryption works.

This is not a secret store. Encrypting a literal does not make a shipped binary a safe home for a signing key or a master credential — the decryption runs on the attacker's machine. Secrets that authenticate your service belong on a server, never in the client, encrypted or not.

Layer 3 — if the logic itself is the value: control-flow + proxying

Renaming hides what a method is called; it does nothing about the readability of what the method does. If someone decompiling the flow of your code — the order of checks, the branches, the structure of an algorithm — is a real loss, control-flow obfuscation is the answer. It reshapes the method body into something that produces the same result but decompiles into a tangle rather than clean C#. See how control-flow obfuscation works. Reference proxying is its companion: it hides the external calls your code makes, so the map of which framework and library members you depend on is no longer in plain view. Both carry a small, usually imperceptible, runtime cost — apply them broadly but keep them off provably hot methods, as explained in does obfuscation slow your app down?

Layer 4 — for the crown jewels only: method virtualization

This is the scalpel, not the blanket. Virtualization converts a method into bytecode for a private interpreter embedded in your assembly, so a .NET decompiler cannot read it as .NET at all — an attacker has to reverse your VM first. It is the strongest layer and the most expensive: a virtualized method runs through an interpreter instead of native code, often several times slower. That makes it perfect for a handful of rarely-run, high-value methods — a licence check, an activation routine, a proprietary calculation — and wrong for anything on a hot path. You opt in per method with a [Virtualize] attribute, so you aim it precisely. Full trade-offs are in what method virtualization is.

Three worked configurations

An internal line-of-business app or a tool you distribute to known customers. The threat is casual curiosity, not a funded attacker. Renaming plus block ILDasm — the free tier — is a sensible stopping point. Add string encryption if the binary is full of internal URLs you would rather not advertise.

A commercial library or desktop app sold to the public. Anyone can buy a copy and decompile it at leisure. Turn on renaming, string encryption and control-flow obfuscation across the assembly. Leave virtualization off unless one or two specific methods are genuinely proprietary. For a desktop app specifically, the end-to-end workflow — which file to protect, the silent WPF binding trap, signing and testing — is in protecting a .NET desktop application.

Software whose value is one algorithm — a pricing engine, a licensing scheme, a trade secret in code. Everything above, plus [Virtualize] on the two or three methods that are the product. Confirm none of them is performance-critical first.

The rule in one line. Turn on renaming always; add string encryption if your literals leak; add control-flow and proxying if your logic is the value; reserve virtualization for the few methods that are the product. Protection is a budget — spend each layer where it pays off and nowhere else.

How the tiers line up

Renaming and block ILDasm are free, with no account. The other four layers — string encryption, control-flow obfuscation, reference proxying and method virtualization — are the Pro plan at $29/month, which also adds the rename map for decoding stack traces, batch processing and the HTTP API. Competing protectors bundle the same class of layers at one-time prices from the low hundreds into four figures; the comparison, feature by feature, is under compare, and every tool's price sits side by side on pricing compared. The honest way to decide is to run the free tier on your own assembly first — obfuscate a file — see what renaming alone does to a decompile, and add layers only where that leaves something exposed you care about.

Try it on your own assembly

Upload a DLL or EXE and download the obfuscated result. Free, no signup, nothing stored.