47
votes

I want to debug empty WebApi Project based on .NET Core 2.2.

I installed Core 2.2 SDK x86 and changed target framework to 2.2:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

When i starting to debug this project, IIS starts, but in route api/values i see nothing (it loading forever) and i get this error:

The target process exited without raising a CoreCLR started event.Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core

In my solution WPF and Class Library projects exist. I wanted to make WebApi for it. Like i said, its empty base project genereted by Visual Studio 2019. I just installed Core 2.2 why i get that error and what im doing wrong?

enter image description here

21
Did you create the project from the "ASP.NET Core Web Application" Template?Arnaud VdP
Yes, i create from Core's WebApimichasaucer
For now i downgraded my proj to 2.1michasaucer
To check whether it is related with this solution, please try to create a new web api .net core 2.2 project, will it work? Try to run command dotnet --list-sdks and dotnet --list-runtimes and share us the result.Edward
Having this issue too, and I never upgraded to 2.2. None of the below suggestions have worked so far.Dylan Nicholson

21 Answers

19
votes

I was facing the same issue!

I updated my Visual Studios to the most recent via the VS Installer.
While updating, I also added the following VS Workloads:

  • ASP.NET and web development
  • .NET desktop development

See about workloads here:
https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/install/modify-visual-studio.md

This worked for me! 😊

I did not have to downgrade or remove anything

17
votes

I had the same issue.
I ran Program.cs file from the command line and the error message was different.
So, apparently, I didn't have the appropriate .NET Core runtime installed.

You can download it by the following link - https://dotnet.microsoft.com/download

12
votes

I had to do a "clean" and "rebuild" of the project and after that it worked again.

4
votes

I had the same error. Remove "Microsoft.AspNetCore.All" from dependencies.

4
votes

I had same issue after package upgrading. You don't need any vs update. Just go to dotnet.microsoft.com/download/dotnet-core/2.2 and get runtime dotnet-hosting-2.2.7-win.

4
votes

In my case, switching to x64 save the day. enter image description here

4
votes

I have downgraded "Microsoft.AspNetCore.App" version and error gone .

3
votes

I ran with the same problem. But for me it was that my project was running in .NET Core 2.2, which I didn't have installed. I'm using VS 2019.

So for the solution, just go to Visual Studio Installer and for your VS 2019 hit "Modify" like in the following image (it's in spanish though): See image here

Then, click "Individual Components", like here.

And then, make sure you checked in ".NET Core 2.2 Runtime (EOL)" (and above like .NET Core 3.0, if you want) and click "Modify", as shown here

Hope this works for you.

2
votes

I got this error because of a Project reference pointing to a project, that did not exist anymore (was removed in merged git-commit). Solved it by right-clicking the project, then Edit Project File, delete the reference and save.

2
votes
  1. Deleting all bin folders of my solution
  2. building everything again did the trick for me

(.NET Core 3.1 VS 2019)

1
votes

I restarted my Visual Studio instance in Admin mode and I was able to debug.

After closing Visual Studio I can now start in normal mode and debug as expected. I'm not sure what changed though.

1
votes

I was missing a reference to AWSSDK.Core. After installing the specific version and re-starting VS2019 and rebuilding, the project ran fine.

1
votes

All of a sudden it stopped working. For me clean solution and re-build solution worked.

1
votes

I was trying to run a project that used net core 2.2 but I didn't have it, and there was no error(I had 1.1), so after installing the 2.2 using the "Visual Studio Installer" it worked like a charm. =)

1
votes

I was getting a similar error with my project: The target process exited without raising a CoreCLR started event.

My startup project was targeting multiple frameworks: netstandard2.0;netcoreapp2.2

I fixed this issue by changing my target framework from netstandard2.0 to netcoreapp2.2 using the following stackoverflow directions: How to switch between target frameworks for .NET Core projects in Visual Studio

1
votes

Be sure to install the exact version of .net core that you want your project to run on

1
votes

I had this issue and finally tracked it down to doing a "publish" operation with a deployment mode of: "Self contained" That resulted in dropping all .NET runtime binaries in my bin directory. Where I think things got totally messed up is I have several solutions all using that same common bin directory, each build different exe's and dll's. Only one was for a self contained deployment as a test. I think that started mixing up some of the minor dlls for the .NET core and causing this issue. Once I purged all the dll's that were "not mine" and rebuilt things started working again. I'm using Visual Studio 2019 16.8.2 / .NET Core 3.1

I realize the original question is regarding .NET Core 2.2 but this question comes up first when searching for the main issue.

1
votes

Faced this issue during xUnit testing. Downgrading nuget package "Microsoft.NET.Test.Sdk" to 15.9.0 worked for me

1
votes

It seems like there are lots of different causes for this. For me, it was because I had upgraded a .csproj file but I hadn't updated the image used in my docker file.

Image showing a 'FROM' line in a dockerfile using a dotnet image on version 5

1
votes

VS2019 16.7.1 ASP.Net Core 3.1

Our Nunit test projects that issued this error, only worked with a very select set of Nunit and Microsoft packages.

  • Microsoft.NET.Test.sdk - 16.5
  • Nunit - 3.12
  • Nunit3TestAdapter 3.16.1

But here's the catch, you have to go into c:\users\yourname\.nuget\packages and look for all three folders shown above. If you find any other version in those folders, delete it.

I found two versions in the Microsoft.NET.Test.SDK folder. I suspect the newer version was being loaded. Why? Because when I deleted it everything ran fine.

0
votes

.Net Core 2.2 is required to be installed. I fixed when I added this in Visual Studio Installer.