'Error: System' could not be found (are you missing a using directive or an assembly reference?) in vs 2019

I tried creating a asp.net core web application with mvc in visual code 2019 and as soon as I open it it showes me a lot of errors like in the picture.

enter image description here

I triend closing and restarting vs, cleaning and rebuilding the solution and restoring nuget packages and it is still not working.



Solution 1:[1]

I got similar issue where it was not able to detect the namespaces from .Net library. I uninstalled the SDK and reinstalled it. then it worked ! Check whether .Net SDK is installed properly in your system and do a clean install once again.

Solution 2:[2]

Right-click your project name then open the properties windows after that downgrade your Target framework version, build Solution then upgrade your Target framework version which is the latest, and then again Build Solution.

Hope it will resolve your issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rahul
Solution 2 Pritom Sarkar