Display lines number in Stack Trace for .NET assembly in Release mode

  • Go into the Properties window for the project where you want to see stack trace line numbers.
  • Click on the Build "vertical tab".
  • Select "Release" configuration. Check the DEBUG constant parameter.
  • Uncheck the "Optimize code" parameter to avoid the occasional trace issue with inlined code (this step is not essential).
  • Press the Advanced... button and choose Output -> Debug Info -> pdb-only.
  • Deploy the generated .pdb file with the assembly.

Implemented with the comment below:

  • One other thing to check is in the "Package/Publish Web" section that the "Exclude generated debug symbols" checkbox is also unchecked

In VS2012 you need to uncheck "Exclude generated debug symbols" in the Package/Publish Web section of the properties as well.


My solution

Copy pdb file in same folder that executable file.

now i can view the line number when run the exe file.

this is reason

http://msdn.microsoft.com/en-us/library/ee416588%28v=vs.85%29.aspx