cppbuild task uses stale cached VS Developer Environment after upgrading to a newer Visual Studio installation · Issue #14800 · microsoft/vscode-cpptools · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cppbuild task uses stale cached VS Developer Environment after upgrading to a newer Visual Studio installation #14800
If using SSH remote, specify OS of remote machine: Running locally
Bug Summary and Steps to Reproduce
Bug Summary:
After upgrading Visual Studio Build tools from 2022 to 2026, IntellSense correctly reports the latest path, while the 'cppbuild' task in .vscode/tasks.json still uses the cached environment, resulting C1083 error: include path cannot be found.
Initially, I speculated that it's a issue in Build tools, but I tried repairing and reinstalling, none of them worked. The enviroment variables in Code.exe seems consistent with vcvarsall.bat, and directly building in command line worked as well.
This suggests the problem must be within the VSCode itself. Eventually I tried "Set VS Developer Environment" (#4742, added in 1.29.0), which fixed the issue.
Seems it caches the detected developer environment somewhere, and this cache is not invalidated/refreshed when the underlying VS installation changes.
Steps to reproduce:
Install VS Build tools 2022
Building any C++ project using cl.exe inside VSCode
Remove VS Build tools 2022, then update to 2026
See error
Expected behavior:
VSCode starting from vcvarsall.bat should build the project successfully.
Chao-Freeman Are you re-using the same terminal? Is this issue fixed after you reload your terminal? The terminal inherits the environment variables and requires a reload afterwards.
No, the issue persists after reloading the terminal. I tried starting VSCode from Native Command Prompt, but it won't build either. However, the integrated terminal contains the correct include path inherited from Native Command Prompt, as follows:
Activity
sean-mcmanus commentedon Sep 29, 2026
Chao-Freeman Are you re-using the same terminal? Is this issue fixed after you reload your terminal? The terminal inherits the environment variables and requires a reload afterwards.
Chao-Freeman commentedon Sep 29, 2026
No, the issue persists after reloading the terminal. I tried starting VSCode from Native Command Prompt, but it won't build either. However, the integrated terminal contains the correct include path inherited from Native Command Prompt, as follows: