20

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?

ASh
  • 34,632
  • 9
  • 60
  • 82
Anton Nel
  • 271
  • 2
  • 3
  • 8

4 Answers4

34

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

Samuel Katz
  • 24,066
  • 8
  • 71
  • 57
4

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.

Ash
  • 5,786
  • 5
  • 22
  • 42
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.

Jack Chen
  • 21
  • 1
-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.

Steve Kennedy
  • 5,312
  • 3
  • 26
  • 41
  • 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 Mar 21 '16 at 23:52
  • 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 :( – Anton Nel Mar 22 '16 at 00:26
  • 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. – Steve Kennedy Mar 22 '16 at 14:13