user5523349
user5523349

Reputation:

Unable to start debugging. The startup project cannot be launched

I'm trying .NET Core today inside Visual Studio 2017. However, it seems I'm unable to debug the application even with barebone Hello World project.

Every time I try to start the project, the following message box appear:

Error Message

I've searched similar issue and come across this thread: Unable to start debugging. The startup project could not be launched. VS2015

I tried every single answer there and nothing worked in my end.
Is there something I missed?

Thanks in advance

Upvotes: 14

Views: 19769

Answers (7)

For me the project were located in another project. After carrying it in another location the problem was gone!

Upvotes: 0

Kelly
Kelly

Reputation: 7183

If you came here looking for a fix due to converting from .NET Framework to .NET Core the problem is your Solution file.

Do this, make a new project with the same name. Copy the .sln file and replace yours. Open the solution and the problem should be fixed.

The first two lines for one made in Visual Studio 2019 are:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16

If your using an old one you might have something like so:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010

Might just be able to change the format, I haven't tested that, but in my case those were the only differences as well as:

VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1

Upvotes: 3

yu yang Jian
yu yang Jian

Reputation: 7171

I close VS2015 and restart, the problem is solved.

Upvotes: 3

Ankush Jain
Ankush Jain

Reputation: 7049

I had the same problem with Visual Studio 2019. I had to disable Azure IoT Edge Tools for VS 2019 extension from Visual Studio. After that, I just restarted Visual Studio and it allowed debugging.

enter image description here

Upvotes: 2

jmrtns
jmrtns

Reputation: 79

I had the same problem (Visual Studio 17.3 and 17.4). I was able to solve today. It turned out that the cause was an extension. After deactivating this extension I was able to debug again.

Edit: In my case it was the "Arduino GDB for Visual Micro 2017".

Upvotes: 5

Greg Terrell
Greg Terrell

Reputation: 1332

After experiencing the error dialog in the original question and I followed the suggestions provided here and on similar SO topics, with no success. Thinking my project was the problem I created a brand new, "Hello World" .NET Core console application.

I could not start the debugger from this brand new project as well. I decided this was a problem beyond my project or solution files. So I decided to repair my Visual Studio 2017 installation, I was running VS 2017 15.5.1.

To repair VS 2017... start Visual Studio Installer, under the Installed section\Visual Studio Professional (my edition is Professional), look for the More [down arrow] option to the right of [Modify] and [Launch], from the More drop-down choose Repair.

This took quite some time (I left for a couple hours), but upon return both the new Hello World and my NETCore application would launch in the debugger.

Upvotes: 2

AngryHacker
AngryHacker

Reputation: 61606

Under your solution (not project), there should be a file called global.json with content like this:

"sdk": {
   "version": "1.0.0-blah-blah"
}

Go to the command line and run: dotnet --version. This will give you the default dotnet version. Replace "version" value with that, save the solution, restart Visual Studio and give it a shot again.

Upvotes: 1

Related Questions