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
Share:
39,455

Related videos on Youtube

Ryu
Author by

Ryu

Software Developer Release Engineer Security Specialist Hacker

Updated on August 11, 2021

Comments

  • Ryu
    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 and DebugSymbols=false property with no luck.

  • Dan W
    Dan W almost 12 years
    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?
  • sfarbota
    sfarbota over 9 years
    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.aspx
  • rollsch
    rollsch over 6 years
    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.
  • Good Night Nerd Pride
    Good Night Nerd Pride almost 6 years
    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.
  • manymanymore
    manymanymore over 3 years
    Does not work for a WinForms project. The pdbs are still added.