Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

cppbuild task uses stale cached VS Developer Environment after upgrading to a newer Visual Studio installation

Đang mở
#14,800 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, typescript, vscode
Lĩnh vực
build-system, devtools

Hướng nghiên cứu

The issue identifies .vscode/tasks.json, vcvarsall.bat, and the “Set VS Developer Environment” command (#4742) as relevant entry points. Trace how cppbuild obtains and caches the developer environment after a Visual Studio replacement, then reproduce the upgrade sequence and verify the generated task uses the new installation without a manual environment reset.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Environment
  • OS and Version: Windows 11 24H2
  • VS Code Version: 1.126.0 (User setup)
  • C/C++ Extension Version: 1.34.4
  • 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:

  1. Install VS Build tools 2022
  2. Building any C++ project using cl.exe inside VSCode
  3. Remove VS Build tools 2022, then update to 2026
  4. See error

Expected behavior:
VSCode starting from vcvarsall.bat should build the project successfully.

Configuration and Logs
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.26100.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

Current database path: %userprofile%\AppData\Local\Microsoft\vscode-cpptools\5a1572067cb7701b835e17d775b99ce1\.BROWSE.VC.DB
Translation Unit Mappings:
[ <PROJECT_DIR>\<file>.cpp - source TU]:
Translation Unit Configurations:
[ <PROJECT_DIR>\<file>.cpp ]
    Process ID: 23980
    Memory Usage: 194 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\bin\Hostx64\x64\cl.exe
    Language: C++
    Include Paths:
        include: C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include
        include: C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Auxiliary\VS\include
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
        include (recursive): <PROJECT_DIR>
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++20
    IntelliSense Mode: windows-msvc-x64
    Other Flags:
        --using_directory
        C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\lib\x64
        --using_directory
        C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\lib\x86\store\references
        --using_directory
        C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.26100.0
        --using_directory
        C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0
        --using_directory
        C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Total Memory Usage: 194 MB
Other Extensions

No response

Additional context
Related issues
  • #14352 and #14089 report a similar-sounding "developer environment" failure, but those describe the feature never successfully applying in the first place.
Ngôn ngữ chính
TypeScript
Star
6.2k
Fork
1.7k
Merge trung bình
18 giờ 37 phút
Pull request đã merge (30 ngày)
50

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/vscode-cpptools

Tất cả issue của microsoft/vscode-cpptools

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.