Remove .pdb path from exe in Microsoft Visual Studio 2010

If you look at executables shipped from Microsoft like notepad.exe, you will see that they include .pdb (Program Database) reference, but do not include path to .pdb:
notepad.pdbvs
d:\some\dir\release\bin\etc\notepad.pdb

This path can sometimes reveal unnecessary information to your customer / user, so if you want to get rid of that path in Visual Studio 2008, you could use undocumented switch:
/pdbpath:none

In Visual Studio 2010 (c++) you can use documented switch:
/PDBALTPATH:%_PDB%

Reference: Visual Studio 2010 – Visual C++ – /PDBALTPATH

Unfortunately, I can not find a such option for .net / C# executables. The only option it seems is /pdb switch, but it is not accessible from IDE.

P.S. To view .pdb reference within exe file, use Hex Editor or dumpbin utility
dumpbin /headers notepad.exe

4 replies on “Remove .pdb path from exe in Microsoft Visual Studio 2010”

  1. Hi,

    In Visual Studio 2002 .NET path to .pdb file can also be removed by adding ‘/pdbpath:none’ to ‘Properties->Linker->Command Line->Additional Options’.
    Assuming that you want debug info in your exe file if not then change
    ‘Properties->Linker->Debug->Generate Debug Info’ to ‘No’ then .pdb file won’t be generated.

    Hope this information will helpful for someone.

    Regards
    Mariusz

  2. Thanks a lot Maris.

    I am moving from VS2008 to VS2013 and setting option /PDBALTPATH:%_PDB% helped me to resolve linker errors. earlier I used to use /pdbpath:none

    Regards,
    Amar

Comments are closed.