Resolving SetEnv error and unopenable source files while using Visual Studio in UE 5.7

I am new to Unreal Engine and have been trying to learn to use it with my existing knowledge of C++. I initially ran into issues with any blueprints I created that inherited from C++ classes losing their inheritance and becoming invalid after closing and opening the project, along with visual studio sometimes being completely unable to find either the object source files or the engine files.

I turned off live coding and am instead trying to build in visual studio directly. Whenever I try to build my project in visual studio however, I receive the following error: “MSB4018 The “SetEnv” task failed unexpectedly.”

I have been trying everything I can to solve this, including repairing visual studio and reinstalling UE 5, but so far nothing has worked. I feel like I must be missing something obvious because there is no way this is a normal thing.

Does anyone know what might be going on here? So far the C++ side of Unreal Engine has not worked since I downloaded it. I am happy to provide additional information.