11

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

  • I would suggest using Visual Studio Code instead of VS2017 to run .Net Core projects. It's free so you can try running it via VS Code – boop_the_snoot Sep 14 '17 at 04:26
  • Right click on your solution and select the above console app as the start up project or give a application restart – roshan_nazareth Sep 14 '17 at 04:26
  • have you tried creating a hello world and running it in the console without visual studio? this will help you confirm if it is vs or your runtime – Neville Nazerane Sep 14 '17 at 04:26
  • I haven't tried .net core outside visual studio. maybe I will try to give it a try. but still, I found it annoying if I cant use visual studio for .net core. @roshan_nazareth its already startup project –  Sep 14 '17 at 07:07
  • By default, .Net Core 2.0 is not installed inside the VS 2017, you need to download and install SDK separatedly – VMAtm Oct 16 '17 at 23:47

7 Answers7

5

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".

Community
  • 1
  • 1
jmrtns
  • 79
  • 4
  • What extension? It is good that you were able to solve the issue in your environment\project, but in order for your comment to be useful to others, you should at minimum name the extension. – Greg Terrell Dec 12 '17 at 15:33
  • I also use the same Arduino extension and was facing same error since last 4 days. Now it is solved. A BIG Thanks! to you. – waghekapil Aug 21 '18 at 12:32
3

I close VS2015 and restart, the problem is solved.

yu yang Jian
  • 6,680
  • 7
  • 55
  • 80
2

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.

Greg Terrell
  • 1,192
  • 13
  • 17
2

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

Ankush Jain
  • 5,654
  • 4
  • 32
  • 57
2

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
Kelly
  • 6,992
  • 12
  • 59
  • 76
  • This was also my problem. Just removing and adding the project to the solution fixed my problems. – MartinH Jun 17 '21 at 09:41
1

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.

AngryHacker
  • 59,598
  • 102
  • 325
  • 594
  • 1
    Hmm.. weird there is no `global.json` either in visual studio or in my project directories.. What should I do? –  Sep 14 '17 at 07:12
  • @tronic Right click on the solution, then `Add`, then `New Solution Folder'. Then create the file in that folder. – AngryHacker Sep 14 '17 at 17:31
  • I tried it, it doesn't work, it still give me same error. Additionally I tried to create the file directly without the folder (so it belongs to "Solution Items" in solution explorer) still not working too –  Sep 15 '17 at 02:44
  • @tronic Ok, last thing to try. Can you download VS 2017 update 3? And also install .NET Core 2. Hopefully that fixes things. – AngryHacker Sep 15 '17 at 07:02
0

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