21

I'm in a really bad situation. I lost my source code and my customer needs to change a little bit in the application. Think of edit an assembly for an example: Test.dll then add a code line and finally recompile it

So my question is: - Is it possible to do that? - If it's possible, what is the good tool to edit an assembly and then recompile it?

Spontifixus
  • 6,570
  • 9
  • 45
  • 63
Bac Clunky
  • 353
  • 3
  • 6
  • 18

3 Answers3

26

Yes, get ILSpy, it has the ability to save an assembly to disk with a .csproj and everything. This makes it easy to open in Visual Studio and recompile.

ILSpy is free and open source.

Save Code

Jacob Stanley
  • 4,704
  • 3
  • 33
  • 36
24

Exporting & recompiling might not be possible for large applications with many assembies, so I'd suggest a different approach:

The most comfortable way to go might be to use Reflexil in combination with .NET Reflector (not free) or JustDecompile from Telerik (very free). I did this a few times and had the best result with JustDecompile - even if I'd prefer ILSpy over JustDecompile at any other time.

"Now, how"? you might ask: Here's a small tutorial from the guys at Telerik.

(look at the topic "How can I inject C# code in an assembly?")


UPDATE

You should definitely look at the new kid on the block: dnSpy

Community
  • 1
  • 1
Waescher
  • 5,361
  • 3
  • 34
  • 51
6

Reflector is the most well known tool for disassembling .net Executables. Another tool is Dis#.

Remko
  • 7,214
  • 2
  • 32
  • 52