How to avoid generating pdb files in static library output path in Visual Studio 2022?

Vishnu Gopalakrishnan 126 Reputation points
2022-02-02T06:17:26.987+00:00

If a project having static library output is compiled in Visual Studio 2022, pdb file is generated in static library output path even if different pdb path is given in C/C++->OutputFiles->ProgramDatabaseFileName.
But when the project is compiled in Visual Sudio 2017, pdb file is not generated in output directory, it is created in the path specified in C/C++->OutputFiles->ProgramDatabaseFileName only.
How to avoid generating pdb files in output directory in Visual Studio 2022,even when the path set in C/C++->OutputFiles->ProgramDatabaseFileName is diferent.
Debug Information format : /Zi
Output Configuration : Static Library (.lib)
Also tried to suppress copy by adding <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory> to the vcxproj file. But wasn't effective, pdb was still generated in output directory.
Any solution for this? Please help.

Thanks in advance.

Developer technologies Visual Studio Debugging
Developer technologies Visual Studio Other
Community Center Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2022-02-14T07:53:59.643+00:00

    Hi @Vishnu Gopalakrishnan ,

    Probably, there are some changes in VS 2022 for this feature. I have found another workaround which may be helpful = > try to modify the Property Page > Configuration Properties > General > Output Directory.(Don't forget to change the Program Database File Name option too)

    Based on my test, if you set this directory to the directory that you’d like to move the generated .pdb file to, then the .pdf file will not be generated in output directory and will be generated to the specific folder.

    BTW, before testing, I suggest you remove the generated .pdf file, in the output directory, and then test again.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.