Askolein
Askolein

Reputation: 3378

How to avoid having (or delete) PDB files in TFS 2012 build result

When using DefaultTemplate from Visual Sturdio 2012 (and TFS 2012 server), the PDB files are included in build directory. I do not want them.

Is there a way not to generate those files during build process?

Or

How can I delete those files?

I found this thread about deletion but seems a bit strange (no delete activity?) There also is this answer but does not involve XAML template.

Thanks in advance for your help.

Upvotes: 3

Views: 5310

Answers (4)

Mohamed.Radwan -MVP
Mohamed.Radwan -MVP

Reputation: 2744

In the previous version (Visual Studio 2010) When we build /release, it was not generating PDBs, the PDB files are created when we only build with /debug:full or /debug:pdbonly, we use /debug:pdbonly if we want to generate PDBs for a release build that we do not want to be debuggable.

This is not the case in Visual Studio 2012, I checked it and I found it generated PDBs in both, /debug and /release

There is no documentation for Visuals Studio 2012.

Upvotes: 2

The build server by default does whatever the Solution (sln) tells it to. That by default is to do a "Debug" build and that created the PDB's. You can tell the Build to do a "Release" build that will not by default create any PDB's...

Adding a Build Configuration Figure: Adding a Build Configuration

I would however recommend against it as the PDB's contain information that you need even in production systems. Consider for a moment that you have a DLL in production and the customer is encountering a problem. You get them to create an InteliTrace log so that you can debug it locally (or they let you debug on their environment) and suddenly you are trying to debug without Visual Studio understanding the relationship between the Executable and the Source Code. So no debug...

Upvotes: 5

drk
drk

Reputation: 865

PDB files hold debug information on your code and its not advised to disable them, they are valid output hence deployment shouldn't be messing with them. You can disable their generation in Visual Studio project Properties> Build > Advanced > Debug Info = none. If you absolutely want them gone then disable them for build specific configuration (relaese etc.)

Upvotes: 6

Askolein
Askolein

Reputation: 3378

Since I was unable to find building option to disable PDB file generation, I delete them afterwards.

There is no easy way to delete files. I did:

  1. use a FindMatchingFiles Activity with wildcard *.pdb, which returns a full path to pdb files
  2. use a Foreach loop
  3. call a DotNet method in the loop for each file with the InvokeMethod Activity, with target type System.IO.File and method being "Delete"

Upvotes: 2

Related Questions