Visual Studio Won't Debug in ArcMap

5076
8
03-22-2011 10:21 AM
KevinLaughlin
New Contributor III
I'm trying to create a user form from which selections can be made in ArcMap. It's not the how of doing so, I can't even begin to debug the project. I keep getting the error "A project with an Output Type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."

I did this (added a startup project and referenced it to my project), and the output window appears, saying it has run successfully but doesn't open ArcMap to test as it has done every other time I've attempted to debug an ArcObjects program.

I've attempted several other fixes which I've found mainly in Window's User Forums, but needless to say, I'm still at a loss.

I've opened a previously successful project and attempted to run it from Visual Studio and I received an error saying the ArcMap.exe was missing.
0 Kudos
8 Replies
KenBuja
MVP Esteemed Contributor
Open the project properties window and check whether the option "Start external program" selection has been chosen in the Start Action section, and that it points to ArcMap.exe
0 Kudos
KevinLaughlin
New Contributor III
Seemed to do the trick, thanks!
0 Kudos
MichaelRobb
Occasional Contributor III
This of course will not apply to Visual Basic Express Edition
0 Kudos
DerekRyter
New Contributor II
I'm having a similar problem in 2010 Express. ArcMap has been reinstalled and is now in a new folder. When I build and run debugger, it says that it can't start debugger because it can't find ArcMap.exe.

How do I tell Visual Studio where ArcMap.exe is?

Thanks,
Derek
0 Kudos
JasonPike
Occasional Contributor
I'm having a similar problem in 2010 Express. ArcMap has been reinstalled and is now in a new folder. When I build and run debugger, it says that it can't start debugger because it can't find ArcMap.exe.

How do I tell Visual Studio where ArcMap.exe is?

Thanks,
Derek


You can try opening the project's user file and adding the StartAction and StartProgram tags to the target you're trying to debug. It is much easier to do in non-Express versions.

MyProject.csproj.user (C#)
MyProject.vbproj.user (VB.NET)

Example:
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files (x86)\ArcGIS\Desktop10.1\bin\ArcMap.exe</StartProgram>
  </PropertyGroup>
0 Kudos
ChaitanyaPeddinty
New Contributor
Right Click on Your Solution and  go for Properties and In That Go for Application TAB, and in that change Output Type  combo Box Option to Windows Application, then Your Problem will resolved.
0 Kudos
JakubSisak
Occasional Contributor III
I'm having a similar problem in 2010 Express. ArcMap has been reinstalled and is now in a new folder. When I build and run debugger, it says that it can't start debugger because it can't find ArcMap.exe.

How do I tell Visual Studio where ArcMap.exe is?

Thanks,
Derek


Having the same issue. Were you able to solve it?
0 Kudos
JohnAnderson1
New Contributor III

As stated by Jason Pyke above, this problem is more difficult to manage with Express versions of Visual Studio.

I can provide some more information with respect to using Visual Studio 2012 Express with ArcGIS 10.3.1 installed, and the relevant ArcGIS SDK, and programming in VB.NET. This could also be relevant to later versions.

When a new Visual Studio project (lets call it "MyProject") is created using the ArcMap Add-in template, the MyProject.vbproj.user file will be created automatically. The MyProject.vbproj.user file is an xml file that contains information that tells Visual Studio to execute ArcMap when running in debug mode. If you have a Visual Studio project that you did not create using the ArcMap Add-in template, or you copied the project from another location, the MyProject.vbproj.user file may not exist, so you need to create it...

As mentioned in some of the posts above, Visual Studio EXPRESS does not give you the option to configure a "Start external program" (which creates and updates a .vbproj.user file) in the project properties window, so you need to create the .vbproj.user file by other means.

One option is to open Visual Studio and create a brand new project (lets call it "NewProject") ensuring that you use the ArcMap Add-In template. If you take a look in the project directory you should find the .vbproj.user file. You should be able to simply copy/paste this file to your MyProject directory but rename it from NewProject.vbproj.user to MyProject.vbproj.user. Reopen the MyProject project (or the Visual Studio solution that contains this project), if everything has worked you should now be able to run your project in debug mode.


Another option (more difficult) is to manually create the MyProject.vbproj.user file using a text editor. It will look something like this below. You need to substitute the path of your ArcMap.exe file if it differs from this example:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files %28x86%29\ArcGIS\Desktop10.3\bin\ArcMap.exe</StartProgram>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    <StartWorkingDirectory>
    </StartWorkingDirectory>
    <StartArguments>
    </StartArguments>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files %28x86%29\ArcGIS\Desktop10.3\bin\ArcMap.exe</StartProgram>
  </PropertyGroup>
  <PropertyGroup>
    <ProjectView>ProjectFiles</ProjectView>
  </PropertyGroup>
</Project>

0 Kudos