msbuild type or namespace 'UnityEngine' could not be found code example
Example: unity using UnityEngine; not working
Update Visual Studio Editor or Visual Studio Editor Code in window->package manger.
Get out of unity and visual studio.
Delete the .csproj and .sln files in your unity project
Open unity and it should work.