Reverb
Reverb

Reputation: 1001

C# Debug - cannot start debugging because the debug target is missing

I am fairly new to C#..

I am using Visual Studio 12, the source I am using was last edited in VS 12.. But my problem is that it's throwing me this error: enter image description here

First of all, my computer username isn't Martin, it is Administratoring - The creator of this project is Martin.. So that's where I guess it's coming from, but I don't know how to fix this.

I have tried editing in Project > Properties > Build > Output Path - And it still doesn't work. I am not too familiar with C#, and I've spent some time searching up for a solution but can't find it anywhere.. Probably because I don't know what I should be searching up (I've tried searching keywords and quotes from the error, but still nothing)

Upvotes: 41

Views: 182865

Answers (15)

sarh
sarh

Reputation: 6617

I had two different build configurations (Debug and DebugCmd) with two different assembly names (let's say, App and AppCmd). If I start my VS 2019 with active Debug configuration and then switch to DebugCmd, VS still tries to debug App (not AppCmd) and fails to start it. The solution is just to restart VS after configuration switch.

Upvotes: 0

Dark Storm
Dark Storm

Reputation: 329

I faced the same problem , but in my solution i had many projects so in the solution configuration the start up project was by mistake a class library i changed the startup project and then i worked like a charm

right click on the sln => common proprties => choose right startup project .

Upvotes: 0

jonadv
jonadv

Reputation: 492

What solved it for me was deleting the line

<ImplicitUsings>enable</ImplicitUsings>

from the project property file. It caused Visual Studio to generate a (useless) file with multiple global using directive.

Upvotes: 0

user9470241
user9470241

Reputation:

I had the same problem with visual studio 2015 , and I found that there is reference is marked so I just deleted it , maybe you can delete this reference or reinstall it again

Upvotes: 0

Merbin Joe
Merbin Joe

Reputation: 688

You are not set the startup project so only this error occur. Mostly this problem occur when your working with more project in the single solution.

First right click on your project and "Set as Start Up Project" and/or right click on the start up file inside the selected project and click "Set StartUp File".

Upvotes: 2

Divinity
Divinity

Reputation: 173

So... it’s mid 2021 and I’m using visual Studio 2019 (version 16.10.2) which is the current version available, on a windows 10 pc.

I had to start a new project and following this steps solved the issue;

  1. When at the menu that says “Create new project”
  2. After you’ve selected your project template it takes you to another menu that says “Configure your new project”
  3. On this menu there’s an option that says “Place solution and project in the same directory”.
  4. By default this option was not checked, so I checked it and it solved the issue.

Upvotes: 0

Khareem
Khareem

Reputation: 71

Go to Project > properties > Debug Tab and set the Launch to "Project"

Upvotes: 1

Ranch Camal
Ranch Camal

Reputation: 570

Application Property

Switch Target framework to 4.5.2 or something higher and bring it back to your original version (example: 4.5) then when you build, it will work.

Upvotes: 2

Dibin
Dibin

Reputation: 1578

Try these:

  1. Make sure that output path of project is correct (Project > Properties > Build > Output path)

  2. Go in menu to Build > Configuration Manager, and check if your main/entry project has checked Build. If not, check it.

Upvotes: 83

Neno
Neno

Reputation: 767

For those with this kind of problem - another solution: Pay attention also to Warnings when you build solution. For example, I had referenced a dll built with higher version of .NET (4.5.2) than my main project (4.5) After I referenced a dll built with 4.0 build process was successful.

Upvotes: 8

Wim Ombelets
Wim Ombelets

Reputation: 5265

In my case I had added a project to a solution manually, where that project was targeting a higher .NET version than the rest of the projects that were referencing it. Strange... there would normally be a somewhat more verbose, literal and descriptive error in such cases.

There wasn't a real error but there was a warning that said as much.

Upvotes: 1

Shima.Y
Shima.Y

Reputation: 383

I had the same problem and unfortunately non of above answers worked for me . the solution that worked for me is :

right click on your startup project and select Properties - Debug and change "start external program: " to the correct path

Done!

Upvotes: 2

olq
olq

Reputation: 191

I had the same problems. I had to change file rights. Unmark "read only" in their properties.

Upvotes: 0

Szabolcs Antal
Szabolcs Antal

Reputation: 947

I also get this error quite often.

I solve this by modifying the code (doing a very small change), saving it, then building the solution again.

Upvotes: 1

Ivaylo Botusharov
Ivaylo Botusharov

Reputation: 31

Please try with the steps below:

  1. Right click on the Visual Studio Project - Properties - Debug - (Start Action section) - select "Start project" radio button.
  2. Right click on the Visual Studio Project - Properties - Debug - (Enable Debuggers section) - mark "Enable the Visual Studio hosting process"
  3. Save changes Ctrl + Shift + S) and run the project again.

P.S. I experienced the same problem when I was playing with the options to redirect the console input / output to text file and have selected the option Properties - Debug - (Start Action section) - Start external program. When I moved the Solution to another location on my computer the problem occurred because it was searching for an absolute path to the executable file. Restoring the Visual Studio Project default settings (see above) fixed the problem. For your reference I am using Visual Studio 2013 Professional.

Upvotes: 3

Related Questions