Problem:  Unable to hit breakpoints when debugging ArcGIS add-in projects in Visual Studio

相关信息
Article ID: 45332
Bug Id: N/A
Software:
ArcGIS for Desktop Advanced 10.2, 10.1, 10.2.1, 10.3, 10.3.1, 10.2.2
ArcGIS for Desktop Basic 10.2, 10.2.1, 10.3, 10.3.1, 10.2.2, 10.1
ArcGIS for Desktop Standard 10.2.1, 10.1, 10.2, 10.3.1, 10.2.2, 10.3
ArcObjects SDK for the Microsoft .NET Framework 10.0, 10.1, 10.2, 10.2.2, 10.3, 10.2.1
Platforms: N/A

问题描述
When a breakpoint is added to an add-in project in Visual Studio, the breakpoint is not hit when debugging the program. (For more information on breakpoints, refer to
Debugging Basics: Breakpoints.)

原因
This issue occurs because the supported runtime version in the configuration (.config) file for the ArcMap add-in application does not match the targeted .NET framework of a Visual Studio project.

In the extensible markup language (XML) code of the ArcMap.exe.config file, lines 4 and 5 state the supported runtime versions for the .NET framework of a Visual Studio project. The compiler reads version 2.0 in line 5, instead of version 4.0 in line 4 as the supported runtime version because line 4 is commented.


.NET 3.0 and 3.5 frameworks support runtime version 2.0 while .NET 4.0 and 4.5 support runtime version 4.0. For more information on .NET frameworks, refer to
How to: Determine Which .NET Framework Versions Are Installed.
已邀请:

EsriSupport

赞同来自:

解决方案
  1. In the ArcMap.exe.config file for the add-in application, located at C:\Program Files (x86)\ArcGIS\Desktop10.3\bin, if targeting the .NET 4.0 framework, uncomment the fourth line of the code by removing the XML comment syntax (underlined in red) to support version 4.0. 
  2. Add the XML comment syntax to comment the fifth line of the code since version 2.0 is not the supported version. 
    Additionally, do the same when targeting the .NET 3.5 (or under) framework.
  3. Save the file.
    Save a copy of the file in a different folder and use it to overwrite the original file if the following error is returned, "The file cannot be saved and it may be protected."
  4. Restart Visual Studio for the changes to take effect.
  5. Debug the add-in application and the breakpoint is hit successfully.


其它相关参考
  1. ArcObjects Help for .NET: .NET 4.0 and 4.5 support for ArcGIS 10.2 Desktop and Engine developers
  2. ArcObjects Help for .NET: How to debug add-ins
  3. Microsoft Help: How to: Target a Version of the .NET Framework


创建及修改时间
Created: 8/19/2015 Last Modified: 10/9/2015
原文链接
http://support.esri.com/en/kno ... 45332

要回复问题请先登录注册