简体   繁体   中英

How do you generate new PDB files every build in Visual Studio 2013?

Problem:

A developer would like to create new Program Database Files (PDB) every time a build has started.

For what scenario:

C++ hot-swapping, debugging on the fly, DLL code plugins for the main program to execute code.

Solution:

  1. Open your code project.
  2. Open Project Properties .
  3. In the left pane, expand the Configuration Properties node.
  4. Expand the Linker node.
  5. Click on the Debugging node.
  6. In the right pane, find the Generate Program Database File entry.
  7. Replace the value as the following:

    $(OutDir)$(TargetName)-$([System.DateTime]::Now.ToString("HH_mm_ss_fff")).pdb

  8. Click on Apply and then Ok .

To start C++ hotswapping (Debugging on the fly) mode:

  1. Have two projects added to a new solution in Visual Studio 2013.
  2. Make one of the projects generate a DLL when building.
  3. Create your program.
  4. For the DLL, write a function that gets constantly called upon while the program is running. Export the function to a DLL.
  5. Set the DLL project to generate new PDB files for each build.
  6. Compile and building all projects.
  7. Start your program without debugging (CTRL+F5).
  8. Update exported DLL function.
  9. Build DLL project once. (CTRL+SHIFT+B).
  10. Your program should then immediately update execution of the function after the second build.

演示C ++热交换。 HTML5 version of the GIF here.

Note:

  • You may add the following value to the Project Properties in order to get rid of excessive PDB files. This can be added to the Pre-Build Event entry in the Build Events node.

    del "$(OutDir)*.pdb"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM