The PowerShell you know and love now with a side of Visual Studio

Ruben Rios

While we know that many of you enjoy, and rely on the Visual Studio Command Prompt, some of you told us that you would prefer to have a PowerShell version of the tool. We are happy to share that in Visual Studio 2019 version 16.2, we added a new Developer PowerShell!

Using the new Developer PowerShell

We also added two new menu entries, providing quick access to not just the Developer PowerShell, but also for the Developer Command Prompt. These menu entries are located under Tools > Command Line.

C:\Users\rurios\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\7DF5E1ED.tmp

Also, you can access the Developer Command Prompt and Developer PowerShell via the search (Ctrl +Q):

Selecting either of these tools, will launch them in their respective external windows, and with all the predefined goodness (e.g. preset PATHs and environment variables) you already rely on.

Opening them from Visual Studio automatically adjust their directories based on current solution or folder’s location. Additionally, If no solution or folder is open at the time of invocation, their directories are set based on the “Projects location” setting. This setting is located under Tools > Options > Locations.

Try it out and let us know what you think!

We’d love to know how it fits your workflow. Please reach out if you have any suggestions or comments around how we could further improve the experience. Send us your feedback via the Developer Community portal or via the Help > Send Feedback feature inside Visual Studio.

25 comments

Discussion is closed. Login to edit/delete existing comments.

  • Mark Zuber 0

    What about directly from the command line?  For cmd there’s vsdevcmd.bat and for a long time I’ve used a custom .ps1 script that runs that and parses out the environment variables into powershell.  Looking at the shortcut for the Developer Powershell for VS2019, I see this:  C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command “& { Import-Module .\Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll; Enter-VsDevShell -InstanceId bb334830}”Do I just need to make my own .ps1 that runs the command there?  it would be really great to have a vsdev.ps1 shipped within Visual Studio itself so I can use vswhere to figure out the proper VS installation and then spin up the dev environment prompt without leaving powershell.It’s great to see powershell getting the attention it deserves here.  Thanks for the work!

    • Ruben RiosMicrosoft employee 0

      Hi Mark! Yes, you can run it by using the command information you above. If you add that command information (e.g. Import-Module .\Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll; Enter-VsDevShell -InstanceId bb334830) to a custom script, you should be able to run it on a regular PowerShell instance.

  • ahmadali shafiee 0

    isn’t it possible to have a command line (except for nuget’s command line) like what we have on vscode?

    • Ruben RiosMicrosoft employee 0

      We’ll have a related announcement soon. Stay tuned! 🙂

      • Ruslan Shupoval 0

        Thanks, Ruben for this update.
        Is it possible to somehow get updated (subscribe/follow/etc) when this kind of functionality will be available?

        • Ruben RiosMicrosoft employee 0

          Easiest way might be to stay tuned to the blog. 

  • Lorenzo Melato 0

    Great tip. Many Thanks.

    • Ruben RiosMicrosoft employee 0

      Glad you like it! 🙂

  • Renato Golia 0

    Could you add the instructions to add the “Developer PowerShell for VS 2019” to the new Windows Terminal?

    • Ruben RiosMicrosoft employee 0

      Hi Retano! While I don’t have instructions to fully add a profile to the new Windows Terminal, you can manually add the additional functionality to a regular PowerShell instance by inputing the command used to run the Developer PowerShell.

      For example, go to the location of your Developer PowerShell shortcut (e.g. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools), open the shortcut Properties and look for the command information available under the shortcuts target information. In particular you want to copy the command that’s getting executed (e.g. “Import-Module \Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll; Enter-VsDevShell -InstanceId f86c8b33”). Once you have that information, add the full path to the module, enter that into the PowerShell instance in the Windows Terminal and you should be good to go.

      In my case (yours will vary based on your paths and VS instance information), I can get it running inside the new Windows Terminal by running this command:
      “Import-Module ‘C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview_master\\Common7\\Tools\\vsdevshell\\Microsoft.VisualStudio.DevShell.dll’; Enter-VsDevShell -InstanceId f86c8b33”

      Hope that helps!

  • Dmitry Maslov 0

    Nice! really lacked this feature

    • Ruben RiosMicrosoft employee 0

      Thanks for the feedback!

  • Travis Illig 0

    This doesn’t seem to be compatible with PowerShell Core. I can import the Microsoft.VisualStudio.DevShell.dll module, but when I run Enter-VsDevShell it tells me:
    The satellite assembly named “Microsoft.VisualStudio.DevShell.resources.dll, PublicKeyToken=b03f5f7f11d5a3a” for fallback culture “en” either could not be found or could not be loaded. This is generally a setup problem. Please consider reinstalling or repairing the application.

    • Ruben RiosMicrosoft employee 0

      Hi @Travis! Yes, we are aware of the lack of PowerShell Core support and while we don’t have any plans to share at the moment, we’ll continue monitoring feedback around this area and revisit things accordingly.

  • Wayne Hiller 0

    What we really need is for this same menu to be available when right clicking on a folder in the Solution explorer. When clicked the window would open to the selected folder. I have to just to folders so often to run npm or dotnet.

    • Ruben RiosMicrosoft employee 0

      Thanks for the feedback @Wayne! We have plans to add a similar feature (e.g. solution explorer support) with a new related experience we’ll announce soon. Stay tuned! 🙂

  • Ben Shirley 0

    Nice addition, for 5 stars however I’d like to do this without leaving my IDE.

    • Ruben RiosMicrosoft employee 0

      Thanks Ben! Hold your 5 stars as we might have some good news for you soon! 🙂

  • Teodor 0

    Is this working with powershell 6 (AKA Core) ?

    • Ruben RiosMicrosoft employee 0

      Hi Teodor! No, at this point we don’t offer support for PowerShell Core.

  • Frank Hileman 0

    Just updated Visual Studio to 16.2.4, and the developer command prompt doesn’t work at all. It seems a specific version of powershell is needed. Cannot load DevShell.dll, … the assembly was built with a newer run-time than the currently loaded one. What are the pre-requisites?

  • Andre Raschke 0

    Kann mann die Powershell dirket mit in die IDE irgendwie “einbauen” als User? das wäre praktisch, dann könnte man sehen welche “ergebnisse ” bei gewissen Anwendungen sich ergeben. Ansonsten : sehr praktisch!

  • Fakhrulhilal Maktum 0

    Why not supporting PowerShell Core? I believe this’s the next generation of powershell, more feature added in this version but not for old powershell.

Feedback usabilla icon