I need something that can generate a PDB from a DLL file (C# .NET code), is there any free program to do that?
-
1In theory it could be done, since with a .net dll you can get the original source code (to within experimental error). The only missing piece is format of the `PDB` file, which is a closely guarded secret. Reflector can take a dll and turn it into a solution, where you can use Visual Studio to compile it *and generate the PDB at the same time*. There are you using Visual Studio to generate a PDB for you - since it knows the secret format. – Ian Boyd Feb 12 '12 at 16:29
5 Answers
Actually you can do it also with dotPeek from 1.2 version onward.
Right click the assembly in Assembly Explorer, and select "Generate Pdb". It also has the option to generate files for referenced assemblies all at once.
-
1if the assembly doesn't contain a debug directory, it will still work if you combine this solution with the previous answer (and remove the .il file before recreating the dll/exe) – sebbu Mar 13 '18 at 16:33
-
Even you have no sources and code obfuscated, you can create pdb by recompile with ildasm and ilasm:
- decompile assembly by ildasm: ildasm /out=assembly_name.il assembly_name.dll
- complile with ilasm: ilasm assembly_name.il /dll /pdb

- 4,445
- 3
- 30
- 46
-
1This is a decent option when combined with http://www.debuginfo.com/tools/chkmatch.html - However, the source stepping will be lines of IL, not c# or vb.net. – JJS Jun 16 '14 at 15:21
PDB contains debug symbols related to DLL, and would normally be built together with the DLL. To enable generating pdb files go to project Properties, Build tab, Advanced... button and select in Debug Info field "pdb-only" or "full":
If you need to debug a thirdparty assembly without sources, then dotPeek and ReSharper will be extremely helpful having an option to generate PDB from DLL. In ReSharper, this can be done through ReSharper > Windows > Assembly Explorer by opening necessary assembly and clicking "Generate Pdb...":

- 10,157
- 3
- 61
- 54
You need the source code in order to generate a PDB.

- 1,023,142
- 271
- 3,287
- 2,928
-
1In other words: it's not possible to create a PDB when all you have is the DLL. – Stephen Cleary May 18 '10 at 16:38
-
11Well, I can use Reflector to get the source, so what I need to get the PDB? – BrunoLM May 18 '10 at 16:43
-
1Remember that you don't get the same source as the one used to compile the DLL. It's a nightmare if there are lambda expressions, iterators, ... not even to mention obfuscation. But suppose that you have some source code, you supply the /pdb option to the compiler (http://msdn.microsoft.com/en-US/library/ms228625(v=VS.80).aspx). – Darin Dimitrov May 18 '10 at 16:45
-
9@BrunoLM Reflector Pro (the 15 day trial they give you) will do exactly this - it'll decompile an entire assembly and will build a PDB so that you can debug into it. – Rup Jan 06 '11 at 10:07
-
2A little bit misleading answer. @Rup is right, I've used this option in the past and it works absolutely well! – Erti-Chris Eelmaa Apr 28 '14 at 11:40