"System.OutOfMemoryException was thrown" adding c++ classes or generating visual studio project files ( UE 5.1 )

This solution might work for this specific problem, but it’ll absolutely break any other programs that are using .NET components that are installed in the x86 directory.

Maybe instead of that you could have found what .NET was installed in the x86 directory and made sure to install the x64 versions instead.