I am trying to create a Visual Studio Developer Powershell profile for Visual Studio Code. Here is what I tried:
"Developer Powershell": {
"path": "pwsh",
"args": [
"-noe",
"-c",
"\"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationpath; Import-Module (Join-Path $vsPath 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation}\""
],
"icon": "terminal-powershell"
}
I copied and pasted the arguments from my Windows Terminal profile, which works:
{
"commandline": "pwsh.exe -noe -c \"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationpath; Import-Module (Join-Path $vsPath 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation}\"",
"icon": "C:\\powershell\\713\\assets\\Square44x44Logo.png",
"name": "Developer PowerShell",
"startingDirectory": "%USERPROFILE%",
}
However, terminal output looks like this:
&{ = &(Join-Path C:\Program Files (x86) '\Microsoft Visual Studio\Installer\vswhere.exe') -property installationpath; Import-Module (Join-Path 'Common7\Tools\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath -SkipAutomaticLocation}
StaggoSTD
Note: I am using Oh My Posh here. That's why the last line looks weird without a nerd font.
So how do I make the Developer Powershell work? I tried using powershell instead of pwsh and removing the escaped double quotes but that did nothing.