Software like DotPeek to decompile and edit DLL's?

32,911

Solution 1

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

Solution 2

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.

Solution 3

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.

Share:
32,911

Related videos on Youtube

Anton Nel
Author by

Anton Nel

Updated on July 09, 2022

Comments

  • Anton Nel
    Anton Nel almost 2 years

    Sorry for this newbie question, but after 3 hours of banging my head on a wall 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?

    THANK YOU!

  • Anton Nel
    Anton Nel over 8 years
    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?
  • Anton Nel
    Anton Nel over 8 years
    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 :(
  • Steve Kennedy
    Steve Kennedy over 8 years
    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.
  • freakinpenguin
    freakinpenguin over 4 years
    Great tool! Thanks for sharing!
  • Maxime Morin
    Maxime Morin about 4 years
    Nice tool! They now have edit method, class and also support exporting as a project!

Related