First, you need a copy of the Mono.Cecil.Pdb.dll assembly, and then add a link to this assembly from your application.
The code you are doing:
var parameters = new WriterParameters (); parameters.SymbolWriterProvider = new Mono.Cecil.Pdb.PdbWriterProvider (); assembly.Write ("myassembly.dll", parameters);
source share