Visual Studio 2022: How to access the built in "Developer PowerShell" instead of the Windows PowerShell?
Asked Answered
I

4

20

In Visual Studio 2022, you can open the Developer PowerShell from Tools>Command Line>Developer PowerShell

In the previous versions of Visual Studio, it used to open the built in PowerShell window:

enter image description here

I can still access this if I use my old window layouts. So it still exists.

However, In VS 2022, if I try to open it from Tools>Command Line>Developer PowerShell, it just opens up a separate window:

enter image description here

Is there any way to open the built-in Developer PowerShell in VS 2022 without using old window layouts?

Infinitude answered 29/7, 2022 at 4:52 Comment(2)
Both my 2019 and 2022 versions of Visual Studio open powershell in its own window.Irregular
@TimothyG. may I ask which version of VS 2022 you have?Infinitude
N
5

Visual Studio 2022 Comm. Right click project in Solution Explorer to open context menu, there you will find "Open in Terminal" command.

Nydia answered 16/7, 2023 at 2:2 Comment(0)
I
26

In a newer version of VS 2022, the Developer PowerShell has been moved to View > Terminal it seems. Confusingly, Tools > Command Line >Developer PowerShell opens up the Windows PowerShell.

Learn more at learn.microsoft.com

Edit: It seems there's a new Developer PowerShell now that is accessible from the start menu as a separate executable. This is what opens up if you try to open Developer PowerShell from Tools in VS. The confusion comes from the integrated "terminal" still being named "Developer PowerShell".

Infinitude answered 31/7, 2022 at 9:18 Comment(1)
The naming and menu layout is so confusing. As far as I can tell, 'Developer' just means they have set some env vars for you, and it's still just the system-installed powershell.exe or cmd.exe. And the two different menu locations just correspond to 'open in VS dockable panel' or 'open in separate window'. I wish all the menu entries were in the same place and were explicit about what you get.Particularly
N
5

Visual Studio 2022 Comm. Right click project in Solution Explorer to open context menu, there you will find "Open in Terminal" command.

Nydia answered 16/7, 2023 at 2:2 Comment(0)
V
0

The developer command line tools are installed here:

Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\'

You can view the VsDevCmd.bat batch file or Launch-VsDevShell.ps1 PowerShell script to see what they do. In short, they are scripts that are invoked by the default Windows system programs. PowerShell, for example, is located here:

Get-ChildItem 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\'

It's worth noting that they do not define the same environment variables, which is rather annoying.

Varicose answered 22/11, 2023 at 17:31 Comment(0)
L
0

You can also make a desktop shortcut which I think is way more useful and easier to find.

  • Click on Start Menu->Navigate to V and expand "Visual Studio 2022"
  • You should see "Developer Powershell for VS 2022"
  • Copy the shortcut to your desktop

Modify the shortcut with your glorious newer Powershell - mine is 7.4.4

  • Right click on the copied shortcut and press 'r' (for properties)

  • Edit the 'target' with the location of your new Powershell. For example mine became:

    "C:\Program Files\PowerShell\7\pwsh.exe" -noe -c "&{Import-Module """C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell 6cc551b1}"

I also changed the "Start in" to c:\Temp - could have chosen my c:\Workspace instead

  • Click Ok.
  • Done.

You have now an easily accessible Powershell command prompt for building Visual Studio things via command line. (The only drawback is when you update Powershell to a newer version and it goes to a different, newer folder, but hey, it's way more fresh than the old 5.1)

Leninist answered 12/8, 2024 at 21:37 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.