Coder Perfect

How do I decompile a .NET EXE into readable C# source code?

Problem

I wrote a C# application for a client a few years ago, but the source code is no longer available. I only have the EXE that I installed on the client’s computer. Is it possible to build C# source code from an EXE?

Asked by MusiGenesis

Solution #1

Reflector and its FileDisassembler add-on.

The source code can be viewed using Reflector. FileDisassembler will convert it to a Visual Studio solution.

Answered by GEOCHET

Solution #2

When Red Gate announced that the free edition of.Net Reflector will be discontinued, I switched to ILSpy and Telerik’s JustDecompile. ILSpy decompiles more accurately than JustDecompile in my experience (which is still in Beta). Red Gate reversed their decision and now offers a free version of.Net Reflector, however I prefer ILSpy currently.

According to the website for ILSpy (https://github.com/icsharpcode/ILSpy/),

ILSpy is an open-source assembly viewer and decompiler for.NET assemblies.

Update:

ILSpy 2.0 was launched on April 15, 2012. In comparison to version 1.0, the following new features have been added:

Update:

Answered by Daniel

Solution #3

Reflector is no longer free in general, although open source developers can get it for free: http://reflectorblog.red-gate.com/2013/07/open-source/

However, several firms, such as DevExtras and JetBrains, have made free alternatives:

DevExtras CodeReflect

JetBrains DotPeek

Answered by arc

Solution #4

Denis Bauer’s Reflector and File Disassembler add-in. It creates source projects from assemblies, whereas Reflector merely displays the disassembled source on its own.

ADDED: JetBrains’ dotPeek is my most recent favorite.

Answered by ProfK

Solution #5

JustDecompile by Telerik is a free tool that allows you to generate projects from.NET assemblies.

Answered by kodefuguru

Post is based on https://stackoverflow.com/questions/179741/how-do-i-decompile-a-net-exe-into-readable-c-sharp-source-code