Software like DotPeek to decompile and edit DLL's?
Asked Answered
F

4

23

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?

Fushih answered 21/3, 2016 at 19:57 Comment(0)
H
36

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

Haemic answered 17/5, 2016 at 0:48 Comment(2)
Great tool! Thanks for sharing!Gujranwala
Nice tool! They now have edit method, class and also support exporting as a project!Alley
D
5

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.

Duren answered 22/8, 2017 at 2:49 Comment(1)
This frequently breaks the assembly as it won't be reconstructed perfectlyLibido
Z
2

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.

Zerlina answered 4/7, 2018 at 5:0 Comment(0)
T
-1

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.

Tedda answered 21/3, 2016 at 20:16 Comment(3)
Thanks for the reply, but I'm a bit perplexed. I created a new Class Library project, and don't know what to do next. I was hoping that DotPeek could edit but apparently it can't. So when I create a Class Library project what do I do next?Fushih
Also worth noting the DLL file has 100's of CS scripts in it so putting them in 1 by 1 isn't an option :(Fushih
Eek. That's really the only way. I don't know DotPeek. So, if it can't export all the .cs files out easily, then you might be out of luck. The idea is, once you've created a new class library project, you start copying those .cs files into the project.Tedda

© 2022 - 2024 — McMap. All rights reserved.