Repository navigation
VS developer environment not found after following tutorial steps; blocked from building #14352
Description
Type: Bug
Blocked from building code by the notification "cl.exe build and debug active file requires the Visual Studio developer environment."
- Uninstall existing VS Code and Developer Tools to start clean
- Install VS Code
- From the Welcome page, click on "Get started with C++ development"
- Install Microsoft.VisualStudio.2022.BuildTools using the instructions provided there, and proceed to follow additional instructions, hitting buttons, etc.
- Close VS Code
- type "developer" into Start Menu to launch developer command prompt
- confirm cl is recognized in developer command prompt
- Launch VS Code
- Go back to the C++ specific Welcome Page, and under the "Apply the Visual Studio developer environment" step, hit the button "Set Developer Environment". Receive a notification of success saying "amd64 developer environment for Visual Studio Build Tools 2022 successfully set."
- Go to my *.cpp file, and hit "Run C/C++ file"
- Choose "C/C++: cl.exe build and debug active file"
Expected result: code builds
Actual result: Get the failure notification "cl.exe build and debug active file requires the Visual Studio developer environment." This notification offers a button "Apply Developer Environment" but when I go through that step it doesn't help and gives me the additional failure notification "The source code could not be built because the Visual Studio developer environment was not applied."
All support info I find suggests this failure notification is due to not launching VS Code from the Developer Command Prompt, but I have done that.
This is possibly related to #14353 since they are both occurring for me.
If it helps to give you more confidence in my repro steps, I can take a screen recording of all of this and attach the video. Let me know if you'd like me to do that.
Extension version: 1.31.4
VS Code version: Code 1.114.0 (e7fb5e96c0730b9deb70b33781f98e2f35975036, 2026-04-01T09:27:11Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz (4 x 2993) |
| GPU Status | 2d_canvas: unavailable_software GPU0: VENDOR= 0x1002, DEVICE=0x677b [AMD Radeon HD 7400 Series], DRIVER_VENDOR=Google, DRIVER_VERSION=8.17.10.1404 GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.19041.5794 Machine model name: Machine model version: direct_rendering_display_compositor: disabled_off_ok gpu_compositing: disabled_software multiple_raster_threads: enabled_on opengl: disabled_off rasterization: disabled_software raw_draw: disabled_off_ok skia_graphite: disabled_off trees_in_viz: disabled_off video_decode: disabled_software video_encode: disabled_software webgl: unavailable_software webgl2: unavailable_software webgpu: unavailable_software webnn: unavailable_software |
| Load (avg) | undefined |
| Memory (System) | 11.96GB (2.46GB free) |
| Process Argv | . --crash-reporter-id 446329a1-4bb8-420a-8b52-627c7d2b9460 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vswsl492cf:30256860
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
4f60g487:31327383
6abeh943:31336334
envsdeactivate2:31464701
cloudbuttont:31379625
aihoversummaries_t:31469308
3efgi100_wstrepl:31403338
56b7f661:31457055
use-responses-api:31390855
defaultusage:31403421
ec5jj548:31422691
cp_cls_t_966_ss:31454198
inlinechat_v2_hd992725:31485760
4je02754:31466945
c3h7c220:31478652
cp_cls_c_1081:31454833
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
showingstats:31481873
i54ji102:31458073
534a6447:31478749
7ef87755:31458076
chat:31457767
t-some:31486549
cpptoolsoff-v2:31475362
signintitlebar:31487064
db0gd219:31481871
ec1eg703:31488002
ddid_t:31478206
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]VS developer environment not found after following tutorial steps[/-][+]VS developer environment not found after following tutorial steps; blocked from building[/+]sean-mcmanus commentedon Apr 6, 2026
gknighted Can you try NOT starting VS Code from the developer command prompt? And instead just use the "Apply the Visual Studio developer environment"?
gknighted commentedon Apr 7, 2026
Sure. Just launching VS Code from the Start Menu, I tried a couple different ways of applying the developer environment but I'm still getting the same result I reported above, not able to build because of the notification "The source code could not be built because the Visual Studio developer environment was not applied."
Here's the ways I tried:
Same experience as (2).
sean-mcmanus commentedon Apr 7, 2026
gknighted Ok, we'll look into it.
bobbrow commentedon Apr 7, 2026
gknighted
After you have applied the Developer environment, please do the following:
Terminal: Show Environment Contributionscommand in VS Code## Extension: ms-vscode.cpptoolssection=signs). We should just need to know which variables are being saved to determine what's missing.bobbrow commentedon Apr 7, 2026
It is also possible that the problem might be with your Path environment variable and we still can't find
cl.exeafter updating the build environment. Can you start a new terminal in VS Code and typecl.exein it to see if Windows is able to find the compiler?gknighted commentedon Apr 8, 2026
Thank you for taking a look Bob!
When I type
cl.exeinto a Terminal pane opened in VS Code, I get:And attached is the text file that is the result of the "Show Environment Contributions" command.
Environment Contributions.md
Both of these give the same results whether I launch VS Code from the developer command prompt, or whether I launch it from the Start Menu and then run the "Set Visual Studio Developer Environment" command.
Please let me know if there's any other way I can help.
bobbrow commentedon Apr 8, 2026
Thank you. In addition to the variables you've listed, cpptools is expecting to find
UCRTVersion,WindowsSdkBinPath, andWindowsSdkDirwhich your environment does not seem to have. Could you tell us which version of the Windows SDK you have and how you installed it? Are you able to compile a simple source file (preferably one that includesWindows.hor some standard headers) in your environment in its current state?4 remaining items
gknighted commentedon Apr 8, 2026
bobbrow commentedon Apr 8, 2026
Ah. I see. I had assumed you were talking about the C++ Walkthrough page in VS Code (below).
Thanks for linking that page. Prerequisites step 3 does not mention the Windows SDK specifically though it should have been selected by default in the installer when you select "Desktop Development with C++". We can call that out specifically. I'll have to think about what kind of check could be done to verify the dependency for the other section.
gknighted commentedon Apr 9, 2026
Bob Brown (@bobbrow) Ah, I see, thanks for the additional info. I have a better understanding of what should be happening now, but I'm still missing environment variables if I'm following the instructions on the "C++ Walkthrough page in VS Code".
This whole time I have been trying to follow both the instructions on what you call "C++ Walkthrough page in VS Code" (which I've been referring to as the "C++ part of the VS Code Welcome page"), and the webpage https://code.visualstudio.com/docs/cpp/config-msvc.
Perhaps we can focus just on the instructions in "C++ Walkthrough page in VS Code" for the moment?
Because the winget command scrolls off-screen as seen in your above image and I was just copying and pasting the contents of that text pane into the Terminal pane of VS Code, I wasn't paying too much to the arguments beyond
winget install Microsoft.VisualStudio.2022.BuildToolswhich is why I wasn't aware of the WindowsSDK and other packages.I have been running the entire command though and just to make sure I just ran it again and it is the result of running this command including all of these packages that has me in my current state of missing the environment variables you identified, so my claim according to my understanding is that the "C++ Walkthrough page in VS Code" instructions are not sufficient to get my environment properly set up.
Here's what I see when I launch Visual Studio Installer:
Once I have done that and installed the Windows 10 SDK, now everything is working as expected in VS Code and I can build.
Therefore, with the current Walkthrough, I would still have been stuck if I hadn't received your support.
It seems like maybe because the Windows 10 SDK has some kind of "out of support" designation, it isn't getting installed by the winget command provided by the Walkthrough even though it is part of the command? Because Microsoft extended the security updates for Windows 10 for one year and my machine cannot upgrade to Windows 11, I am still running Windows 10.
Thanks again for your time and engagement on this, I really appreciate it!
gknighted commentedon Apr 9, 2026
Bob Brown (@bobbrow) And then with regards to https://code.visualstudio.com/docs/cpp/config-msvc, thanks for making that update to the page. I'm only one opinion of course so please use your discretion as to how much to consider it, but if you don't mind me providing a bit of feedback on your pull request change, I'm not sure those changes would have been effective for me. This is because the mention of the MSVC toolset and SDK happen in a paragraph starting with "If you have a recent version of Visual Studio". I don't have Visual Studio, I only have VS Code, so I would have thought that paragraph was not applicable to me and I would have focused on the next paragraph that was applicable to me that starts with "You can also install the Desktop development with C++ workload without a full Visual Studio IDE installation."
It might be clearer to make it explicit that these products are needed regardless of whether you have Visual Studio or not.
bobbrow commentedon Apr 9, 2026
This might be a big part of why the winget command failed. The version listed in the installer doesn't match what our command was trying to install. I'm not sure when or why this changed. There used to be a newer version of the Windows 10 SDK that isn't available via the VS installer anymore. There is no Windows 10 SDK listed in the documentation anymore either. I will submit a PR to change the version number to match what's in the installer now (19041).
In my PR, I will also add a note that the command scrolls off the page and should be copied in its entirety. When I wrote this walkthrough I did try to get VS Code to wrap this element so it wouldn't scroll off the page, but it only actually wrapped it in Markdown Preview mode which was frustrating and I eventually gave up. I'll see if Copilot can help me come up with a workaround or something.
The pre-requisite step says "Install the Microsoft Visual C++ (MSVC) compiler toolset." first, but I can see how it might be easily skipped over in favor of the paragraphs. I think the true problem with this section right now is that the Installer does not behave as expected on Windows 10 anymore. The C++ workload is supposed to select a Windows SDK by default, but since the only Windows 10 option is "out of support" it doesn't appear to do that anymore. I'll see if I can rework this to emphasize the necessity of a Windows SDK being present in a way that can be found for both installation cases.
gknighted commentedon Apr 9, 2026
Bob Brown (@bobbrow) that all sounds great! One last detail I can provide in case it’s helpful is that in the VS Code terminal, the winget operation was reporting as succeeded, so I didn’t realize it was failing to install one of the packages requested. I don’t know if maybe there’s a way to get it to fail instead in that case. If so, I would have been able to give you more salient info earlier on.
bobbrow commentedon Apr 9, 2026
I linked a new PR for the walkthrough. Unfortunately, if winget isn't going to notify you about the failure to install one of the packages, I'm not sure what else we can do.
gknighted commentedon Apr 9, 2026
You’re a rockstar! Thanks so much for everything.
sean-mcmanus commentedon Apr 15, 2026
gknighted Fixed with 1.32.0 pre-release (https://github.com/microsoft/vscode-cpptools/releases/tag/v1.32.0).