P.Brian.Mackey
P.Brian.Mackey

Reputation: 44285

Are we looking at the original code in a Disassembler or reverse engineered CIL?

Take ILSPy. When I view my assembly am I looking at my original C#? Or, is this code reconstructed from CIL using some type of reverse engineering process?

My understanding is that release assemblies do not include any original code, just CIL. So, does it make a difference if I build my assembly in release mode?

Upvotes: 2

Views: 428

Answers (4)

real_yggdrasil
real_yggdrasil

Reputation: 1263

Actually, you could use ILMerge or .net FuZe to wrap your exe and dlls into an exe or dll container, making it more difficult to disassemble.

Upvotes: 0

mattypiper
mattypiper

Reputation: 1232

Release vs Debug still makes a huge difference. The compiler does optimize. See Scott Hanselman's post about Release vs Debug.

In terms of what ILSpy does, yes it displays CIL and then reverse engineers it to a reasonable C#/VB representation. I'll admit ILSpy does a very good job with it! I've reversed others' assemblies with it and can make perfect sense of their code. The only time I've had it break down was with WPF and GUI stuff, but I'm sure there are ways to work that as well.

In terms of preventing reversal of your assembly and protecting your intellectual property, use Dotfuscator or other obfuscation tool.

Upvotes: 4

yoyo
yoyo

Reputation: 8726

You are seeing code reconstructed from the IL. This reconstruction process can be performed on any .NET assembly regardless of whether it is built in debug or release mode.

You can't prevent your source code from being reconstructed from your assembly in this way, but if you want to make the code less useful/understandable you can use various .NET obfuscation tools.

Upvotes: 1

SLaks
SLaks

Reputation: 888047

Neither release nor debug assemblies contain original source code.

ILSpy & friends analyze the compiled CIL to extract a reasonable C# equivalent.

Upvotes: 4

Related Questions