Mark Needham

Thoughts on Software Development

Building in release mode with no pdbs with msbuild

with 3 comments

I’ve been having trouble trying to work out how to build our projects in msbuild in release mode without creating the customary pdb files that seem to be created by default.

I tried calling msbuild.exe with the ‘Release’ configuration:

'C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.Exe ( Proj.csproj /p:OutputPath=\output\path\ 	/p:Configuration=Release)'

To no avail. It still created the pdb file. Next I tried setting the ‘DebugSymbols’ property to false:

'C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.Exe ( Proj.csproj /p:OutputPath=\output\path\ 	/p:Configuration=Release /p:DebugSymbols=false)'

Still it created the file. Finally I found this post which suggested that you actually needed to make the change in the Proj.csproj file itself.

I changed this part of the file so that DebugType is now ‘none’. It had a value of ‘pdbonly’ when I opened the file.

  none
  true
  bin\Release\
  TRACE
  prompt
  4

The pdb is no longer created.

*Update*
This can also be done by passing /p:DebugType=none as a command line argument as Tim points out in the comments.

Written by Mark Needham

August 20th, 2008 at 6:50 pm

Posted in .NET,Build

Tagged with , , , ,

  • http://www.codespaces.com Floyd Price

    I simply don’t see what this has to do with batch scripts!

  • http://trgoodwin.blogspot.com Tim Goodwin

    You don’t have to change it in the proj.csproj file.
    Its like any other property and can be overridden via the command line via:

    /p:DebugType=none

    same diff.

  • http://www.markhneedham.com Mark Needham

    Ah cool, thanks -> shall just do that instead then!