Disable generating PDB files in MsBuild
Asked Answered
D

1

89

I'm looking to squeeze some more speed out of my build and was wondering if I could instruct msbuild to not generate PDB files. I'm passing the Configuration=Release and DebugSymbols=false property with no luck.

Digit answered 21/4, 2009 at 17:54 Comment(0)
M
148

You may have PDB generation in your release configuration. Add this to your release settings:

<DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType>

You can also, do this in your project configuration inside visual studio. Disable PDB Generation

Also, if running MSBuild from the command line, the command line arguments would be

MSBuild.exe YourProject.csproj /p:DebugSymbols=false /p:DebugType=None
Masonite answered 21/4, 2009 at 18:4 Comment(5)
I found the MSBuild version worked with "/p:DebugType=None" alone (i.e. didn't create the pdb file). It didn't seem to need "/p:DebugSymbols=false" too. Is there any advantage to having both?Hansom
It seems that both arguments do the same thing, so you just need one or the other. More info can be found at msdn.microsoft.com/en-us/library/bb629394.aspxBequeath
Putting it in the project file means its guaranteed to always be disabled, so if you were distributing the project without any make batch file etc this would be the best way to do it.Bern
Setting /p:DebugSymbols=false had no effect with Microsoft (R)-Build-Engine, Version 15.8.166+gd4e8d81a88 for .NET Core. I had to use /p:DebugType=None.Siskin
Does not work for a WinForms project. The pdbs are still added.Porosity

© 2022 - 2024 — McMap. All rights reserved.