Disable generating PDB files in MsBuild
39,455
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
Related videos on Youtube
Author by
Ryu
Software Developer Release Engineer Security Specialist Hacker
Updated on August 11, 2021Comments
-
Ryu almost 3 years
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
andDebugSymbols=false
property with no luck. -
Dan W almost 12 yearsI 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?
-
sfarbota over 9 yearsIt 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.aspx
-
rollsch over 6 yearsPutting 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.
-
Good Night Nerd Pride almost 6 yearsSetting
/p:DebugSymbols=false
had no effect withMicrosoft (R)-Build-Engine, Version 15.8.166+gd4e8d81a88 for .NET Core
. I had to use/p:DebugType=None
. -
manymanymore over 3 yearsDoes not work for a WinForms project. The pdbs are still added.