The project could not be compiled. Would you like to open it in Visual Studio?(very popular question with no answer )

Hi guys, I saw many many people ask this question and apparently there is no absolute answer to this question.

this happened for me when I uninstall my visual studio 2015 cause unreal 4.18 no matter I do use VS 2015 and I want to use 2017 and I saw some people solve this problem with uninstalling VS 2015.

when I uninstall VS 2015 receive this error when I want to create a new C++ project:

The project could not be compiled. Would you like to open it in Visual Studio?

Running f:/Program Files/Epic Games/UE_4.19/Engine/Binaries/DotNET/UnrealBuildTool.exe MyProject451 Development Win64 -project="F:/c++ New/New folder/MyProject451/MyProject451.uproject" -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for MyProject451 (no existing makefile)
@progress push 5%
Parsing headers for MyProject451Editor
  Running UnrealHeaderTool "F:\c++ New\New folder\MyProject451\MyProject451.uproject" "F:\c++ New\New folder\MyProject451\Intermediate\Build\Win64\MyProject451Editor\Development\MyProject451Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for MyProject451Editor in 7.2801937 seconds
@progress pop
Performing 9 actions (4 in parallel)
[2/9] Resource ModuleVersionResource.rc.inl
[3/9] Resource PCLaunch.rc
SharedPCH.Engine.cpp
MyProject451GameModeBase.cpp
MyProject451.init.gen.cpp
MyProject451.cpp
MyProject451GameModeBase.gen.cpp
[8/9] Link UE4Editor-MyProject451.dll
[9/9] Link UE4Editor-MyProject451.lib
LINK : fatal error LNK1181: cannot open input file 'ws2_32.lib'
   Creating library F:\c++ New\New folder\MyProject451\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject451.lib and object F:\c++ New\New folder\MyProject451\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject451.exp
ERROR: UBT ERROR: Failed to produce item: F:\c++ New\New folder\MyProject451\Binaries\Win64\UE4Editor-MyProject451.dll
Total build time: 34.18 seconds (Local executor: 0.00 seconds)

photo of error :

many peoples mention its relate to Windows SDK and there is windows SDK in installing if I add more let me know.

I thought if I install unreal 4.19 its maybe get fixed but it didn’t.

it seens ue4 genrate C++ files for VS 2015.

I hope there is anyone known how to solve this problem and guide me how.

I fix it with downloading this cleaner form this link Releases · microsoft/VisualStudioUninstaller · GitHub .
after that UE4 when you want to create new project sends a message and it says you don’t have VS2017 don’t panic just download the installer and modify it after that it downloading about 350 mg and after that, everything will get fixed.
for more info :
New C++ Project fails to compile using UE 4.15 and VS 2017 Community Edition - LINK : fatal error LNK1181: cannot open input file 'ws2_32.lib' - C++ - Unreal Engine Forums