I created a new net5 project using this command dotnet new webapi -n UserService --framework net5.0
I can run the app with dotnet run
. But I cant debug it in VsCode. I get the error below. In my .cspoj file target framework is already set to net5.0. How can I debug my donet5.0 project in VsCode?
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '6.0.0' was not found.
- The following frameworks were found:
5.0.17
my .cspoj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
</Project>
I solved the problem. The culprit was the new version of C# extension in VsCode. Looks like new versions doesn’t support dotnet5. Installing the older version of the C# extension 1.24.1 solved the problem.