I was losing my mind over this, thanks
This happens when you have installed Unreal Engine 5.1 an higher (my Version 5.3.2 November 2023) and don’t have the .NET 6.0 SDK installed. So, make sure to install the .NET 6.0 SDK. I had the same problem and this resolved it!
Thank you!!!
This problem is due to (.generated.h) line of code.
This line should be separate from all others.
It’s help me:
This worked for me. Visual Studio 2022 and Unreal Engine 5.5.