10
votes

I have a solution converted from VS2010 to VS2012. In the Release build, I want it to produce PDB files and full debug symbols because I need to run remote debugging in a production environment.

So I set Debug Info to full for Release configuration. I also confirmed the followings are in the project manifest file:

<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimized>true</Optimized>

But when I run MSBuild, the package it creates doesn't include the PDB files. However, if I use Visual Studio's Publish feature with Release configuration, I end up with PDB files on the target web server. What could be wrong with the Build command?

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "C:\MyWebApp.csproj"  
  /t:rebuild;package 
  /p:OutPath="C:\MyWebApp\obj" 
  /p:OutputPath="C:\MyWebApp\bin" 
  /p:Configuration=Release 
  /p:Platform=AnyCPU

I tried turning off the Optimized bit, but that didn't help.

2

2 Answers

12
votes

Try adding

/p:DebugSymbols=true

/p:DebugType=full

If you are publishing a web application then you should also add:

/p:ExcludeGeneratedDebugSymbol=false

3
votes

You can access this straight from the command line:

msbuild.exe "C:\\MyWebApp.csproj" /t:rebuild;package /p:OutPath="C:\\MyWebApp\\obj" /p:OutputPath="C:\\MyWebApp\\bin" /p:Configuration=Release /p:Platform=AnyCPU /p:DebugType=pdbonly