Developer PowerShell and Developer Command Prompt are installed with VS 2019.
I鈥檇 like to add these profiles automatically when installing Windows Terminal on a machine with VS 2019 installed.
I think this is useful for developers using Visual Studio.
Maybe they should just be added to https://github.com/microsoft/terminal/blob/master/doc/user-docs/ThirdPartyToolProfiles.md
This could be the VS 2019 CMD, Community Edition
{
"commandline": "cmd.exe /k \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat\"",
"icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
"name": "Developer CMD for VS 2019"
},
And this for the VS 2019 Powershell, Community Edition
{
"commandline": "powershell.exe -noe -c \"&{Import-Module \"\"\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"\"\"; Enter-VsDevShell 9be17693}\"",
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
"name": "Developer PowerShell for VS 2019"
},
Both based on the start menu entries added by VS setup. They work fine for me.
They work fine for me.
For me Developer PowerShell for VS 2019 is generating an error on startup:
Enter-VsDevShell : 9be17693
No linha:1 caractere:132
+ ... ools/Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell 9be17693}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Enter-VsDevShell], ItemNotFoundException
+ FullyQualifiedErrorId : VsInstallationNotFound,Microsoft.VisualStudio.DevShell.Commands.EnterVsDevShellCommand
Gotcha. Actually the profile provided by @ffes work as expected, since you change the identifier after Enter-VsDevShell to the identifier in Developer PowerShell for VS 2019 shortcut. Mine, for example, is 4704b565.

Yes. If you want to add a profile for yourself, you need to get the instance ID from the shortcut in the start menu and set it on the command line.
Windows Terminal has a mechanism to dynamically generate profiles.
I think the VSSetup PowerShell module will help implement Developer Console Profile Generator.
https://github.com/microsoft/vssetup.powershell/tree/develop/src/VSSetup.PowerShell
I have this setup;

I had to create the icon besides just adding the profile. It would be great if all the dev prompts with appropriate icons were added by default (VS2017, VS2019 etc).
For the Powershell configuration, I've used the following. So far, so good.
,
{
"commandline": "powershell.exe -noe -c \"&{ install-module vssetup -Scope currentuser; $i=(get-vssetupinstance); $i; Import-Module \"\"\"$($i.InstallationPath)/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"\"\"; Enter-VsDevShell $i.Instanceid;}\"",
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
"name": "VS2019 Powershell"
}
The following link https://docs.microsoft.com/visualstudio/install/tools-for-managing-visual-studio-instances helped me to find the instance ID (I have been using the vswhere command)
The Developer PowerShell profile that using vswhere command.
{
"name": "Developer PowerShell",
"commandline": "powershell.exe -NoExit -Command \"&{ $vsInstallPath=& \"${env:ProgramFiles(x86)}/'Microsoft Visual Studio'/Installer/vswhere.exe\" -prerelease -latest -property installationPath; Import-Module \"$vsInstallPath/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell -VsInstallPath $vsInstallPath -SkipAutomaticLocation }\"",
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png"
}
Hi,
I'm extremely interested in this. How can I open an "x64 Native Tools Command Prompt for VS 2019" with Windows Terminal? Note that this is slightly (but importantly) different from the "Developer Command Prompt for VS 2019".
If that was available from the Windows Terminal dropdown menu (with a nice icon) like in @Greyze's screenshot above, that would be even more amazing.
@patrikhuber You can right click the .lnk in start menu, and view what parameters it uses in the details, and compare between them.
@huoyaoyuan: It shows Target: as:
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
Modifying the snippet posted here https://github.com/microsoft/terminal/blob/master/doc/user-docs/ThirdPartyToolProfiles.md#developer-command-prompt-for-visual-studio works for me:
{
"name": "x64 Native Tools Command Prompt for VS 2019",
"commandline": "%comspec% /k \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat\"",
"startingDirectory": "%USERPROFILE%",
"icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png"
}
Thank you!
Is there any way of setting this to the Visual Studio 2019 icon? I tried this, but it (expectedly) doesn't work:
"icon": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe"
Do I have to extract the icon from the .exe using a 3rd-party tool, or is there an easier way?
The docs don't mention anything https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-settings#icon.
Sadly there isn't a convenient way for that to automatically be added. I had to work around it.
I downloaded the VS2019 icon from the microsoft website. I'll add it here for you:

I then dropped that image file into the terminals installation directory/RoamingState folder. Since I installed Terminal from the MS Store my folder is:
C:\Users\*\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState
Lastly in the settings.json, i added the icon with this path:
"icon": "ms-appdata:///roaming/vs2019-32.png"
You should be good to go now. Obviously tweak the paths to your preferred choice. For clarity heres my whole settings block for VS2019 which gives you the terminal you saw in my image above:
{
"acrylicOpacity": 0.75,
"commandline": "cmd.exe /k \"C://Program Files (x86)//Microsoft Visual Studio//2019//Enterprise//Common7//Tools//VsDevCmd.bat\"",
"guid": "{184f02e0-01c0-495e-9d97-b2467ec16958}",
"historySize": 9001,
"icon": "ms-appdata:///roaming/vs2019-32.png",
"name": "Developer Command Prompt for VS2019",
"startingDirectory": "%USERPROFILE%",
"useAcrylic": true
},
@Greyze Thanks a lot, that's great! :)
One can also extract the .ico from devenv.exe, with Visual Studio, without any third party tool. Visual Studio => Open => File... => devenv.exe => expand "Icon" => right-click on the one you want, "Export". The .ico also works as "icon" for Windows Terminal.
Most helpful comment
Maybe they should just be added to https://github.com/microsoft/terminal/blob/master/doc/user-docs/ThirdPartyToolProfiles.md
This could be the VS 2019 CMD, Community Edition
And this for the VS 2019 Powershell, Community Edition
Both based on the start menu entries added by VS setup. They work fine for me.