Anton Nel
Anton Nel

Reputation: 321

Software like DotPeek to decompile and edit DLL's?

I just got DotPeek and I found it is PERFECT for looking into .dll files. However I can't edit them at all. Is there free software like DotPeek that also lets me edit the DLL instead of just looking at it?

UPDATE: I was able to save all the .cs files in the .dll file separately and edit them in VS (Visual Studio). Now how do I get them back into the .dll file after editing?

Upvotes: 24

Views: 58011

Answers (4)

Jack Chen
Jack Chen

Reputation: 21

for minor IL code change, use dnSpy to modify the IL code is a easy way. for major .NET code change, use DotPeek to decompile the assembly and export it to a VS project. then you can edit the .cs code and rebuild from the new project.

Upvotes: 2

Ash
Ash

Reputation: 6035

In the latest version of DotPeek you can right click on an assembly in the assembly explorer tree view and click the 'Export To Project' option. This will save it as an accessible Visual Studio solution and you can then make changes, debug in run time and recompile to replace the original DLL.

Remember it only provides this option for assemblies and not individual classes within an assembly.

Upvotes: 5

Celmaun
Celmaun

Reputation: 24762

Simpler method: You can use dnSpy to edit a managed DLL's bytecode directly using the right click -> "Edit IL instructions" option and save the DLL back from File -> Save Module.

dnSpy: Edit IL Instructions

Upvotes: 37

Steve Kennedy
Steve Kennedy

Reputation: 5402

I would save all the .cs files in the .dll file separately and edit them in VS (Visual Studio). You can create a new CLASS LIBRARY project, which just is a set of .cs files that can BUILD. So, make sure it builds (CTRL+SHIFT+B). When you do, you should find the newly created .dll in the \bin folder under that project's directory.

Upvotes: -1

Related Questions