Building C++ project in 5.1 gives: Failed to create CoreCLR, HRESULT: 0x80004005

For anyone else who also encountered this problem, my problem was because my .NET 6.0 Runtime isn’t installed properly, so what I did is:

  1. Open Visual Studio Installer, and select modify (I’m using Visual studio 2022)

  2. Proceed to the Workloads tab, remove all the check marks shown in the tutorial picture here

  3. and after removing everything, go to your system’s settings’ programs and features, and check if there are some remaining .NET stuff, take a picture(just incase you need to reinstall some of the other ones), and delete all of it

  4. finally go back to the Workloads tab and tick those on again, and wait for it to reinstall, and voila! you should be able to create / build C++ projects again!

Hope this will help anyone in confusion!