To open Developer PowerShell for VS 2022, choose Tools > Command Line > Developer PowerShell in Visual Studio, or open View > Terminal to get it as a tab inside the IDE. Outside Visual Studio, search the Start menu for "developer powershell", or run Launch-VsDevShell.ps1 from the Visual Studio Tools folder.
All of these start the same thing: PowerShell with the environment variables that Visual Studio's command-line tools need. The sections below cover each way in, what the shell sets up, and how to fix the usual problems.
What Developer PowerShell is
Visual Studio ships two developer shells. The Developer Command Prompt is a standard command prompt with certain environment variables set. The Developer PowerShell is PowerShell with the same environment variables set, so you can pipe the output of one cmdlet into another. Microsoft documents Developer PowerShell as available since Visual Studio 2019.
The point of the environment variables is that you can type a tool's name without knowing where it lives. Microsoft's list of popular commands includes:
| Command | What it does |
|---|---|
MSBuild | Builds a project or solution |
dotnet, dotnet run | .NET CLI commands |
CL, NMAKE | C/C++ compile tools |
LIB, DUMPBIN | C/C++ build tools |
clrver, ildasm | .NET Framework tools |
If you only need to run dotnet, a normal PowerShell window is often enough. The developer shell matters mostly for MSBuild and the C/C++ toolchain, where a plain window will report that the command is not recognised.
Open it from inside Visual Studio
- Open Visual Studio 2022.
- On the menu bar, select Tools > Command Line > Developer PowerShell.
A separate window opens. If a solution is loaded, the shell opens in that solution's directory, which is convenient for running commands against its projects. The same menu has Developer Command Prompt if you prefer cmd.
Open it as a tab in the Visual Studio terminal
Since Visual Studio 2019, the IDE has an integrated terminal that can host either developer shell, and you can open several tabs of each. The terminal is built on top of Windows Terminal. To show it, select View > Terminal.
The terminal takes its shells from profiles. When the feature was introduced, Microsoft's announcement described adding profiles by hand on the terminal's Options page: each profile needs a shell location and optional arguments. For a Developer PowerShell profile, it said to take the arguments from the Target string of the Developer PowerShell shortcut. The Options page and the default profiles may have changed since that 2019 post, so check the terminal's own options in your version if the profile you want is missing.
Open it from the Start menu
Windows 11: select Start, type developer powershell into the search box, and select the app result.
Windows 10: select Start, scroll to V, expand the Visual Studio 2022 folder, and select Developer PowerShell for VS 2022. Typing the name into the taskbar search box also works.
You can have several entries with similar names, depending on which Visual Studio versions, SDKs and workloads you installed. Check the name says VS 2022 if you have more than one version installed, because each shortcut is set up for its own version.
Launch it from an existing PowerShell prompt
If the shortcut is missing, or you want the developer environment inside a shell you already have open (for example inside a build script), run Launch-VsDevShell.ps1. It lives in the Common7\Tools folder of the Visual Studio installation. For the Community edition in the default location:
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1'
Change Community to Professional or Enterprise to match your edition, and adjust the drive or folder if you installed elsewhere. The path varies with the Visual Studio version, edition and install location. By default, the shell it configures is for the Visual Studio installation that contains the script.
The script finds the Microsoft.VisualStudio.DevShell.dll module in the installation, loads it, and then calls the Enter-VsDevShell cmdlet. The Start menu shortcuts load the module and call the cmdlet directly. Microsoft calls the script the recommended way to initialise Developer PowerShell interactively or for build automation.
Check that it worked
Run a tool that only exists in the developer environment:
MSBuild -version
Example output (the version number depends on your installation):
MSBuild version 17.x.x.xxxxx for .NET Framework
17.x.x.xxxxx
In a plain PowerShell window, the same command usually fails because the command isn't on the path.
Choose a target architecture
For compilers that produce architecture-specific output, you can pass arguments to the script. In Developer PowerShell the arguments are -Arch for the target and -HostArch for the machine running the build tools. They need Visual Studio 2022 version 17.1 or later. For example, to build for ARM64 from a 64-bit machine:
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch arm64 -HostArch amd64
| Architecture | As target (-Arch) | As host (-HostArch) |
|---|---|---|
| x86 | Default | Default |
| amd64 | Yes | Yes |
| arm | Yes | No |
| arm64 | Yes | No |
If you set only the target, the shell tries to make the host match it. That can fail when the target is an architecture that isn't also supported as a host, such as arm64, so set -HostArch explicitly in that case.
Stay in your current folder
The launch script changes to the Visual Studio project location, which overrides your working directory. To keep the current directory, add -SkipAutomaticLocation:
cd C:\work\myapp
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation
The project location itself is set in Visual Studio under Tools > Options > Projects and Solutions > Locations. The -Arch, -HostArch and -SkipAutomaticLocation arguments work with both the script and the Enter-VsDevShell cmdlet.
If it doesn't work
The script is blocked by the execution policy
Running Launch-VsDevShell.ps1 needs scripts to be allowed. Microsoft's PowerShell documentation says that if no execution policy is set in any scope, the effective policy on Windows clients is Restricted, which blocks all script files. To allow local scripts for your user account only:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
A Group Policy setting overrides this in every scope, so on a managed work machine the change may not take effect. Use Get-ExecutionPolicy -List to see which scope wins. The full explanation is in How to Enable Running Scripts in PowerShell.
The Start menu entry is missing
Shortcuts are normally placed in the Start Menu folder for Visual Studio, for example under %ProgramData%\Microsoft\Windows\Start Menu\Programs\. If search finds nothing, go to the Common7\Tools folder of your installation and use Launch-VsDevShell.ps1 as shown above. For the Command Prompt equivalent, the file is VsDevCmd.bat in the same folder.
Tools are still not found
Check that the workload providing the tool is installed. The developer shell only sets variables; it does not install the C++ or .NET build tools. Open the Visual Studio Installer and confirm the workload is ticked. Also confirm you opened the shell for the right version: a VS 2019 shell will not give you the VS 2022 toolchain.
Developer PowerShell versus VS Code's terminal
Developer PowerShell belongs to Visual Studio, the full IDE. VS Code has its own integrated terminal and is a different product with a separate command-line interface. If you are unsure which of the two you have installed, see VS Code vs Visual Studio.
Frequently asked questions
- What is the difference between Developer PowerShell and a normal PowerShell window?
- Developer PowerShell is regular PowerShell with the environment variables set for Visual Studio's command-line tools. Because of that, commands such as MSBuild, dotnet, CL, NMAKE, LIB and DUMPBIN can be run without knowing where they are installed. A normal PowerShell window does not have those variables, so those tools are usually not found.
- Why can't I find Developer PowerShell for VS 2022 in the Start menu?
- The shortcut is created by the Visual Studio installer, so it only exists for installed versions and workloads. On Windows 11, search for 'developer powershell' and pick the app result. If nothing appears, open the Tools folder of your Visual Studio installation and run Launch-VsDevShell.ps1 from a normal PowerShell prompt.
- Does Developer PowerShell start in my project folder?
- Yes, when opened from Visual Studio with a solution loaded, it opens in the solution's directory. Launch-VsDevShell.ps1 also changes to the Visual Studio project location by default. Add -SkipAutomaticLocation to stay in the folder you were already in.
- Is Developer PowerShell available in Visual Studio 2019?
- Yes. Microsoft documents it as available since Visual Studio 2019, along with the integrated terminal that can host it. The -Arch and -HostArch arguments, however, need Visual Studio 2022 version 17.1 or later.