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

I tried to delete the dotnet folder from c:\Program Files (x86) but Windows prevented me because the folder is being opened by other programs.

I’ve tried using dotnet-core-uninstall but it only detects dotnet from c:\Program Files which are uninstallable, not the x86 folder.

Would appreciate if you can share how you deleted that dotnet folder