Software like DotPeek to decompile and edit DLL's?
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.
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.
Related videos on Youtube
Anton Nel
Updated on July 09, 2022Comments
-
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 over 8 yearsThanks 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 over 8 yearsAlso 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 over 8 yearsEek. 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 over 4 yearsGreat tool! Thanks for sharing!
-
Maxime Morin about 4 yearsNice tool! They now have edit method, class and also support exporting as a project!