7

I am developping an ArcMap 10.3 Add-In targeting .NET framework 4.5 on Visual Studio 2013. I used ESRI's wizard to build a simple button add-in and the projects debug properties are configured to start the external program "C:\Program Files (x86)\ArcGIS\Desktop10.3\bin\ArcMap.exe".

The add-in ran properly when I started debuggig the Add-In for the first time but I couldn't get the breakpoints to hit. I followed ESRI recommandation "How to debug" on ESRI online help and modified the ArcMap.exe.config file to enable supported runtime 4.0.30319

<startup>
     <supportedRuntime version="v4.0.30319"/>
      <!-- <supportedRuntime version="v2.0.50727"/> -->
</startup>

The next time I started debuggin the Add-In I get an error message from Visual Studio : "Error while trying to run project: Unable to start program 'C:\Program Files (x86)\Desktop10.3\bin\ArcMap.exe'."

Visual Studio 2013 error

This error message comes right after ArcMap's splash screen. The following screenshot is not from the actual Add-in because the splash screen appears and disappears way too fast and I can't get screenshot.

ArcMap 10.3 splash screen

I tried different things but without success :

  • build the project using different platforms :"Any CPU" and "x86"
  • changed "ArcCatalog.exe.config" file to use the same supported runtime
  • restarted computer
  • used different supported runtime version: version="v4.0.30319", version="v4.0", version="v4.5"

I dont know what to do next to be able to debug the Add-in. I don't want to develop without this feature!

3
  • target version 3.5 which is the supported version. Commented Jun 11, 2015 at 16:46
  • .Net version 3.5 is no problem. As you said, it is the supported version. I'm still working on the problem and I was able to run an Add-In for ArcGIS Desktop 10.2.2 on Visual Studio 2010 and .Net 4.0. I'm suspecting Visual Studio to be the problem. I am currently installing a virtual machine with ArcGis 10.3 and Visual Studio 2012/2010 to see if VS is the actual problem. I will post the update.
    – staker4
    Commented Jun 11, 2015 at 17:32
  • As I suspected Visual Studio 2013 is the culprit. I installed Visual Studio 2012 on the same machine and I was able to debug an ArcGIS Desktop 10.3 Add-In with .Net 4.5. I don't know the exact reason why I'm having these problems with VS2013. I will keep searching a little bit.
    – staker4
    Commented Jun 11, 2015 at 17:50

4 Answers 4

16

In Visual Studio 2013, to fix this check Use Managed Compatibility mode in VS2013 > Options > Debugging > General (last option in the list).

Original answer by Preston McCormick here

2
  • This worked for me in VS 2015 as well. Thanks.
    – TurboGus
    Commented Dec 5, 2016 at 17:01
  • 2
    Works for VS 2017 also but the "Use Managed Compatibility Mode" is further up in the list, not at the bottom like in 2013.
    – Tim Sexton
    Commented Aug 15, 2017 at 20:56
5

In order to debug ArcMap 10.3 Add-in with VS2013 in .Net 4.5. I had to attach VS2013 to ArcMap.exe process. This is kinda annoying but it is the only way I got it to work for now. I'm still confused on why this is happening.

How to attach process

  1. Start ArcMap
  2. In VS2013, go to menu "DEBUG" -> "Attach to Process"
  3. Select "ArcMap.exe" and click on "Attach" button
  4. In ArcMap, make sure the Add-In is installed.

If the Add-in is not installed whe you attach the process, you can try one of these things :

  • Stop debugging and reattach process until Add-Inn is installed
  • Install Add-in manually from your add-in debug folder.
2
  • That's kind of annoying. I use VS2010 and don't have that problem... could it be just a matter of selecting Enable the Visual Studio hosting process in the solution properties? There was a similar bug in 9.3.1 with VS2008; based on the vague error message it's hard to say what the problem is, or stems from. Commented Jun 18, 2015 at 5:23
  • 1
    In VS2010 and VS2012, everything works fine. Only VS2013 causes problems and the "Enable the Visual Studio hosting process" in the Add-in project library is checked but also grayed out. Since the Add-in is a DLL and the DLL project can't have a hosting process.
    – staker4
    Commented Jun 18, 2015 at 17:31
3

Here is how I resolve this issue and it works pretty much every time it comes up.

  1. Restart VS2013
  2. Right click on project -> Debug -> Start new instance (this will prevent it from building first)

If above doesn't work then:

  1. Restart VS2013
  2. Use Select some project as Startup then click Start in the toolbar.

If that doesn't work this works every time:

  1. delete all DLLs from output directory (we have one output directory for all DLLs/EXEs that we're building)
  2. rebuild all projects.
  3. restart vs2013
1
  • Thank you for your answer. #3 did the trick for me (delete all DLLs, rebuild , debug -> start new instance)
    – staker4
    Commented Oct 14, 2015 at 12:08
1

In Visual Studio,

Go in your project properties and go to the tab Debug. Make sure that in the section "Start Action", the radio button "Start External Program" is checked and that you put the map to your ArcMap execution file. In my case: "C:\Program Files (x86)\ArcGIS\Desktop10.3\bin\ArcMap.exe"

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.