Okay here is a workaround. Open Visual Studio from powershell that way when Visual Studio opens up it will register the clean environment instead of your regular polluted one.
$ENV:PATH = "C:\windows\system32"
# This command will open up visual studio
# See this stackoverflow: https://stackoverflow.com/a/60228336
start devenv
I modified my registry so that I could launch VS2019 from powershell. I enter the following in powershell:
PS D:\s> $ENV:PATH = “C:\Program Files\CMake\bin;C:\windows\system32”
PS D:\s> $ENV:PATH
C:\Program Files\CMake\bin;C:\windows\system32
PS D:\s> start devenv
VS2019 starts. I open my project. I save CMakeLists.txt (because this is the only way I know how to get CMake to initialize when starting VS). I get the same result:
1> CMake generation started for configuration: ‘win64-Debug’.
1> Command line: “C:\WINDOWS\system32\cmd.exe” /c “%SYSTEMROOT%\System32\chcp.com 65001 >NUL && “C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe” -G “Visual Studio 15 2017” -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING=“Debug” -DCMAKE_INSTALL_PREFIX:PATH=“D:\s\CMakeBuilds\f1e0f0a6-b40c-47b9-ac01-10c27884e354\install\win64-Debug” --trace-expand --trace-redirect=“D:\CMake_gencache_debug.txt” “D:\s” 2>&1”
1> Working directory: D:\s\CMakeBuilds\f1e0f0a6-b40c-47b9-ac01-10c27884e354\build\win64-Debug
1> [CMake] Running with expanded trace output on.
1> [CMake] Trace will be written to D:/CMake_gencache_debug.txt
1> [CMake] Trace will be written to D:/CMake_gencache_debug.txt
This website is a pain in the ass for new users…
As a new user you can’t link more than two items
As a new user you can’t attach more than one item
As a new user you’ve reached your post limit for the day and have to wait xxx minutes