Saturday, 3 September 2016

How to generate .pdb files when assembly does not contain "Debug" folder.

I recently had a problem with Resharper's dotPeek ability to create Pdb files from the decompiled assemblies. The problem was that when the assembly was built they had removed the Debug folder information.

The solution was quite simple... Along with VisualStudio, you get 2 executables.

  • ILDasm - an IL Disassebler that takes an assembly and disassemble it to a text file. This file can be then be used as input for the ILAsm.
  • ILAsm - an IL Assembler that takes an IL text file as input (the one you get by using ILDasm) and creates a portable executable(PE).
And this is how they do the magic:

C:\>ildasm Source.dll /out=Source.il
C:\>ilasm /dll /pdb /Out:Source.dll Source.il

If the assembly is strong name signed we can use sn -Vr <Assembly> to disable verification.

Note: The information on this post was extracted from Evgeny Rodavsky's blog post.
The original blog post and more information can be found here:

No comments:

Post a Comment