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
VS developer environment not found after following tutorial steps; blocked from building #14352
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)
changed the title [-]VS developer environment not found after following tutorial steps[/-][+]VS developer environment not found after following tutorial steps; blocked from building[/+]on Apr 4, 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 Can you try NOT starting VS Code from the developer command prompt? And instead just use the "Apply the Visual Studio developer environment"?
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:
Trying to Run Codedirectly after launching VS Code
Try to Run Code
Click "Apply Developer Environment"
Using "Set Visual Studio Developer Environment"
Try to Run Code
Click "Apply Developer Environment"
Using the "Set Developer Environment" button on the Welcome page
gknighted
After you have applied the Developer environment, please do the following:
Run the Terminal: Show Environment Contributions command in VS Code
Navigate to the ## Extension: ms-vscode.cpptools section
Share the list of environment variables that are appearing there.
Please note there is personal information in the values of the variables. You can delete all the values before sharing them (e.g. everything after the = signs). We should just need to know which variables are being saved to determine what's missing.
@gknighted After you have applied the Developer environment, please do the following:
Run the Terminal: Show Environment Contributions command in VS Code
Navigate to the ## Extension: ms-vscode.cpptools section
Share the list of environment variables that are appearing there.
Please note there is personal information in the values of the variables. You can delete all the values before sharing them (e.g. everything after the = signs). We should just need to know which variables are being saved to determine what's missing.
It is also possible that the problem might be with your Path environment variable and we still can't find cl.exe after updating the build environment. Can you start a new terminal in VS Code and type cl.exe in it to see if Windows is able to find the compiler?
When I type cl.exe into a Terminal pane opened in VS Code, I get:
PS VSCode_CPlusPlus> cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35224 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
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.
Thank you. In addition to the variables you've listed, cpptools is expecting to find UCRTVersion, WindowsSdkBinPath, and WindowsSdkDir which 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 includes Windows.h or some standard headers) in your environment in its current state?
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.
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.BuildTools which 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:
Then I click on "Modify":
I see the same MSVC Build Tools checked that are in your image. But I don't see the Windows SDK. So then I expand "Desktop development with C++" on the right under "Installation Details" and see there's one "Windows 10 SDK" option, so I check that and then hit "Modify":
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!
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.
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.
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).
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.BuildTools which is why I wasn't aware of the WindowsSDK and other packages.
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.
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."
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.
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.
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.
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.
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).