Visual Studio DevShell
I haven’t really been keeping up with the new Visual Studio 2019 previews but I didn’t come across an interesting feature after I updated to the latest Preview bits: The Developer Console but powered by PowerShell.
Clicking on this opened up a new window and loaded that all to familiar view but this time I have my (albeit not fully visualized) PowerShell prompt
Now I have all the wonders of the Developer Command Prompt but with PowerShell power and all is good in the world.
Except, I’d rather get access to this in my normal terminal. So after dissecting the shortcut I added the following lines to my $PROFILE
so that I can get the command prompt configuration whenever I open a new prompt.
So, what is happening here?
First, using vshwere
, I determine the location of the version of 2019 that I have installed on my machine. Because I only use 1 version and that’s the preview release, I have to pass that flag to vshwere
to make sure it’s found. I grab the installationpath
property from the results and store that in a variable.
Now that I have that I can import the module Microsoft.VisualStudio.DevShell
into my environment. Once that’s imported, it’s a trivial call to Enter-VsDevShell
with the already captured installation path. I ultimately send that to $null
so that I don’t see the banner that usually shows up when you enter the shell.
Now I can go about using the utils that I’m accustomed too which is mostly these days the tf
command.