Hello @Martin Keernik ,
Welcome to Microsoft Q&A forum.
Please first try to reboot your machine, download a new VS setup file and put it in the root directory of the C drive for example C:\VSSetup.exe
and then run it.
If everything includes VS worked well, before you uninstalled it, then this issue may be related to remained cache/files of VS. If there was an error before you uninstalled VS, then this issue may be related to this error.
Please check following folders/Registry keys(remember to back up the Registry keys before removing them) and make sure that they have been removed or renamed before you try to install VS.
C:\Program Files (x86)\Microsoft Visual Studio
C:\Program Files\Microsoft Visual Studio
%programdata%\Microsoft\visualstudio\packages
%Temp%(I suggest just renaming this folder, instead of removing it. You may need to reboot your machine before renaming it)
C:\Users\username\AppData\Local\Microsoft\VisualStudio\1X.0_XXXXXXXX
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\VisualStudio\Setup
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\Setup
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\Setup
If you changed anything like environment variables, Windows Registry keys or removed any files, please try to recover them.
In case it’s related to the error which you got before uninstalling VS, please try following:
Open CMD as administrator, run DISM.exe /Online /Cleanup-image /Restorehealth
command, wait for it finishes running, run sfc /scannow
command to fix any corrupted system files.
Try to download and follow the wizard program to install and use the troubleshooter tool.
Update Windows OS.
Disable antivirus, extensions or proxy temporarily and test again.
Please feel free to let us know the results.
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.