Generates Pdb files for assemblies compiled with Roslyn

Topics: APIs
Sep 15, 2014 at 7:34 PM
I am trying to compile a series of projects into DLLs, and it works.

This is my code.
var solution = await ciSolution.GetSolutionAsync();

            var applicationDirectory = Assembly.GetExecutingAssembly().Location;

            var roslynDirectory = Path.Combine(Path.GetDirectoryName(applicationDirectory), "Roslyn");

            foreach (var project in solution.Projects)
                var filePath = project.OutputFilePath;

                var filename = Path.GetFileName(filePath); 


                using (var stream = new FileStream(Path.Combine(roslynDirectory, filename), FileMode.OpenOrCreate))
                    var compilation = await project.GetCompilationAsync();
The problem is that I can't understand how generates also the Pdb files to debug the DLLs created with Roslyn.

Any suggestion?

Thanks in advance

Sep 15, 2014 at 9:18 PM
The Emit method has two optional parameters; pdbStream and pdbFilePath. Use pdbStream to provide a stream to which the corresponding pdb should be written. You can also use pdbFilePath to customize which name it should have.
Marked as answer by TomasMatousek on 9/17/2014 at 7:24 PM
Sep 15, 2014 at 10:34 PM
Hi Jesper, I just tried your suggestion and it works!

Thank you very much!