I was following this tutorial on building an application with ASP.NET Core API
and Angular
where I used a laptop that had .NET 5
installed.
I got a new laptop and after I installed all the latest tools, I am now on .NET 6
and when I open my app to carry on where I left off, I get the following error when I run dotnet watch run
in the VS Code terminal in the backend folder:
The framework 'Microsoft.AspNetCore.App', version '5.0.0' (x64) was not found.
- The following frameworks were found:
6.0.5 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=x64&rid=win10-x64
Here are 2 screenshots showing what I have installed in this app from the time I was using it on my old laptop (now opening it and trying to run it on my new laptop)
Is there anyway I can cleanly update everything I need in one go, instead of installing .NET 5
or AspNetCore.App version 5.0.0
etc?
CodePudding user response:
Just correct the TargetFramework
element's text content to net6.0
.
Also update the NuGet
packages.
Don't mind what's inside the bin
and obj
folders, whereas exist. Even better, make sure to Clean
or Rebuild
your project.