I wrote a C# application for a client a couple of years ago, but I no longer have the source code. All I have is the EXE that I deployed on the client's PC. Is there a way I can generate C# source code from the EXE?
-
3Ok. Look here ... Teleriks JustDecompile actually decompiled the DLL's that Red Gates Reflector completely screwed up ... there were numerous issues with Reflector ... JustDecompile ... flawless so far ... – Marc Johnston Jul 03 '15 at 03:48
-
2I have been using JustDecompile for quite a long time and it is really good at decompiling and package the source files as a ready to compile csproject. It is really active in development and there seems to be no open issues in their repo https://github.com/telerik/JustDecompileEngine – David Chelliah May 29 '16 at 15:40
9 Answers
Reflector and its add-in FileDisassembler.
Reflector will allow to see the source code. FileDisassembler will allow you to convert it into a VS solution.

- 3,925
- 1
- 31
- 52

- 21,119
- 15
- 74
- 98
-
4My copy of Reflector has an "Export..." option and I have no plug-ins installed. It creates a VS project with all the source code and resources. So why is everyone suggesting FileDisassembler? It is better? – Lucas Oct 07 '08 at 22:10
-
Lucas: Out of the box, I have not seen reflector able to do this. FileDisassembler has always been the only way. This may have changed in recent history though I guess. I will check it out. – GEOCHET Oct 08 '08 at 11:49
-
LIFE SAVER! dumb ass TFS deleted my project. Although I did tell TFS to delete itself but didnt expect it to remove the project from the local file system. thanks all the same. x – Christo May 28 '13 at 05:32
-
-
It work for .Net framework only. any tool which work for .Net core 3.0 exe ? – Somnath Kadam Oct 12 '19 at 05:09
When Red Gate said there would no longer be a free version of .Net Reflector, I started using ILSpy and Telerik's JustDecompile. I have found ILSpy to decompile more accurately than JustDecompile (which is still in Beta). Red Gate has changed their decision and still have a free version of .Net Reflector, but now I like ILSpy.
From the ILSpy website (https://github.com/icsharpcode/ILSpy/):
ILSpy is the open-source .NET assembly browser and decompiler.
ILSpy Features
- Assembly browsing
- IL Disassembly
- Decompilation to C#
- Supports lambdas and 'yield return'
- Shows XML documentation
- Saving of resources
- Search for types/methods/properties (substring)
- Hyperlink-based type/method/property navigation
- Base/Derived types navigation
- Navigation history
- BAML to XAML decompiler
- Save Assembly as C# Project
- Find usage of field/method
- Extensible via plugins (MEF)
Update:
April 15, 2012, ILSpy 2.0 was released. New features compared with version 1.0:
- Assembly Lists
- Support for decompiling Expression trees
- Support for lifted operatores on nullables
- Decompile to Visual Basic
- Search for multiple strings separated by space (searching for "Assembly manager" in ILSpy.exe would find AssemblyListManager)
- Clicking on a local variable will highlight all other occurrences of that variable
- Ctrl+F can be used to search within the decompiled code view
Update:
- ILSpy 2.1 supports async/await decompilation

- 5,602
- 4
- 33
- 36
-
1I'm using 2.2 and it supports decompiling to IL, VB.NET, and C#. I found this very useful. – VoteCoffee Oct 30 '14 at 14:45
-
1It seems Telerik is interested in collecting questionable information from the computer running on it and ILSpy cannot be compiled from sources. Also ILSpy binary mixes up variable names and puts some strange characters in the source code. – AaA Apr 27 '16 at 03:00
-
1Note that ILSpy includes a Visual Studio add-in. For ILSpy 2.4 I added the ability to navigate from your Visual Studio source code direct to the decompiled output. Unfortunately there were some late-breaking fixes that are now merged to the ILSpy mainline but did not make the 2.4 release. – yoyo Jul 20 '16 at 18:01
-
Brilliant! There's a software company that charge people £100 a time for them to use a "special" tool on your sever in order to fix issues. Managed to get a copy of the tool they used while connected, and then managed to use ILSpy very easily to get the tool unlocking password. No more ripping off customers! – user2924019 Jan 19 '17 at 13:39
-
Reflector is no longer free in general, but they do offer it for free to open source developers: http://reflectorblog.red-gate.com/2013/07/open-source/
But a few companies like DevExtras and JetBrains have created free alternatives:

- 4,692
- 1
- 41
- 44

- 801
- 6
- 3
-
5Reflector is like 35$. Breaking the bank I know, but its worth 10x that. – StingyJack Oct 05 '11 at 16:55
-
actually the alternatives listed here work better than Reflector, at least for some kinds of obfuscation. – Tener Oct 10 '11 at 11:12
-
7It's worth adding Telerik JustDecompile to the list of free .NET assembly decompilers, too. http://www.telerik.com/justdecompile – Todd Oct 13 '11 at 21:12
-
6@StingyJack: Great, looks like they heard you! It's now actually 10 the price at $368 if you want the VS2012 disassembler. :/ – DeepSpace101 Feb 09 '13 at 20:13
-
2I dont hold it against them for making money, but ILSpy (mentioned) in @Daniel's answer is what I am using now. – StingyJack Feb 11 '13 at 14:29
-
3It now costs $100 for the standard version and $200 for the version that integrates with Visual Studios. That's a heck of an inflation rate. Although they do offer stuff for free to open source developers: http://reflectorblog.red-gate.com/2013/07/open-source/ – VoteCoffee Oct 30 '14 at 14:57
Reflector and the File Disassembler add-in from Denis Bauer. It actually produces source projects from assemblies, where Reflector on its own only displays the disassembled source.
ADDED: My latest favourite is JetBrains' dotPeek.

- 49,207
- 121
- 399
- 775
-
I like that dotPeek allows working with an entire folder easily, but as of today they only decompile to c#. Most other decompilers also do vb and IL. It also only supports up to Net 4.5 whereas Telerik supports 4.5.1 – VoteCoffee Oct 30 '14 at 15:04
-
so dotPeek is totally free or they have restrictions for paid version?. i couldnt see any information on jetbrains website regarding it. – Emil Jan 05 '19 at 15:33
Telerik JustDecompile is free and has a feature to create projects from .NET assemblies.

- 554
- 4
- 4
-
Telerik offers the ability to decompile to VB.NET, IL, or C#.NET which I found useful. It also auto-selects the framework and has a plug-in available for deobfuscicating. Also, it support .NET 4.5.1. Seems pretty good. – VoteCoffee Oct 30 '14 at 14:54
-
1I tried all the solutions here in this post and JustDecompile was the only one that works perfectly for me. – Alvaro Pereira Jan 17 '17 at 14:41
I'm surprised no one has mentioned Microsoft's ildasm. It may not be as pretty as ILSpy or Reflector, but it comes with Visual Studio so many developers already have it.
To run it (assuming VS 2013, should be similar for other versions):
- Select Start > All Programs > Visual Studio 2013 > Visual Studio Tools.
- Double-click on Developer Command Prompt for VS2013.
- Run "ildasm" from the resulting command prompt.
- In the tool, select File > Open and open your executable or DLL.
Now you can navigate the DLL structure. Double-click on class members to see the IL. Use File > Dump to export IL to a file.

- 8,310
- 4
- 56
- 50
-
I find IL DASM to be a bit barbaric. It shows the tree , but when right clicking does nothing I find that insane. Plus the Dump of the export to file is basically garbage. Look at it, how it that even remotely helpful? – Tom Stickel Nov 03 '15 at 06:10
-
5I never claimed ildasm was the best option out there, only that it's available and it works. ¯\_(ツ)_/¯ – yoyo Nov 04 '15 at 00:41
-
-
1I was really surprised that dotPeek would not let me search the whole Assembly for a string I knew was in there. ildasm may not be pretty but at least it has a dump option that helped me locate the class that contained the string I was looking for. – Gabe Halsmer Nov 19 '18 at 19:11
I'm surprised no one has mentioned dnSpy. dnSpy is a debugger and .NET assembly editor. You can use it to edit and debug assemblies even if you don't have any source code available.
Main features:
- Debug .NET and Unity assemblies
- Edit .NET and Unity assemblies
- Light and dark themes
It is open source and one of most widely used reverse engineering tool for dot net.

- 349
- 4
- 5
-
not sure why I got downvoted, I am simply listing a tool which is used by most dotnet reverse engineers today. And IMHO, it does answers the question the question which is getting the source code of an app compiled in C#. – Noteworthy Jan 11 '21 at 12:13
There are various .NET / C# Decompilers available nowadays (2022):
- ILSpy for everyone [free OSS C# IL multi-platforms]
- dotPeek for convenient decompilation [free C# IL]
- dnSpy for gurus, security and hackers [free OSS C# VB IL]
- JustDecompile for everyone [free OSS C# VB IL] (continued as CodemerxDecompile)
- IldAsm for nostalgia [free IL]
- .NET Reflector for history [commercial unsupported C# VB IL MC++]
My preference goes to ILSpy because it is free, OSS, very fast (compared to others), so well maintained it is even used by Visual Studio and decompiled code is accurate. This blog post In the Jungle of .NET Decompilers explains in details all these .NET decompilers.

- 13,237
- 6
- 61
- 92