Include PBD files in ClickOnce deployment to show the line numbers in the Stack Trace

If there is an error in an application, the line numbers are only included in the Stack Trace when the PBD files are also in the application directory.

To include the PBD files in an application that was distributed with ClickOnce deployment you need to:

  • Right click the main project and select Properties
  • On the Build tab
    • Uncheck Optimize Code to make sure the line numbers in the Stack Trace match the source code
    • Click the Advanced… button at the bottom of the window
    • Set Debug info to full
      VS PBD 01

  • On the Publish tab click the Application Files… button
    • On the Application Files window select the Show all files check box in the lower right corner
    • Change the Publish Status of the PBD files from Exclude (Auto) to Include
      VS PBD 02
    • Click OK to save the changes

Leave a comment

Your email address will not be published. Required fields are marked *