Adding Visual Studio Developer Tools - Incorrect paths #16824

Open
opened 2026-01-31 05:24:07 +00:00 by claunia · 0 comments
Owner

Originally created by @fdacumos on GitHub (Feb 18, 2022).

Windows Terminal version

1.12.10334.0

Windows build number

10.0.19042.0

Other Software

Visual Studio 2019
Visaul Studio 2022

Steps to reproduce

  1. Install Visual Studio 2019
  2. Install Windows Terminal
  3. During the install, choose to add the Visual Studio Developer Tools as a Profile (Developer PowerShell for VS 2019)
  4. Install Visual Studio 2022
  5. Attempt to open up the "Developer PowerShell for VS 2019" WT Profile

Expected Behavior

When going to Windows Terminal, I should be able to open up my VS 2019 Developer Prompt by selecting "Developer PowerShell for VS 2019". However, it errors out and the icon is also missing.

Actual Behavior

I get the error:

Import-Module: Assembly with same name is already loaded
Enter-VsDevShell: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'VsInstallPath'. Specified method is not supported.

Reasons:
The Problem is with the Windows Terminal Profile settings. For that WT Profile, under commandLine it shows:

"commandline": "C:\\Program Files\\PowerShell\\7\\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}\"; cd ~",

If you have multiple versions of Visual Studio installed, the vswhere.exe will return an Array of items, so the PowerShell to register is incorrect. It needs to reference the first element of the $vsPath variable. This can be manually fixed by editing the settings and changing the line to:

"commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe -noe -c \"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationpath; Import-Module (Join-Path $vsPath[0] 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath[0] -SkipAutomaticLocation}\"; cd ~",

Missing Icon
Also, for the missing Icon, the default install references the Icon under the Visual Studio "Enterprise".

"%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png",

If you have Visual Studio "Professional" installed, the icon will break. Simply fix this by changing the line to:

"%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Professional\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png",
Originally created by @fdacumos on GitHub (Feb 18, 2022). ### Windows Terminal version 1.12.10334.0 ### Windows build number 10.0.19042.0 ### Other Software Visual Studio 2019 Visaul Studio 2022 ### Steps to reproduce 1. Install Visual Studio 2019 2. Install Windows Terminal 3. During the install, choose to add the Visual Studio Developer Tools as a Profile (Developer PowerShell for VS 2019) 4. Install Visual Studio 2022 5. Attempt to open up the "Developer PowerShell for VS 2019" WT Profile ### Expected Behavior When going to Windows Terminal, I should be able to open up my VS 2019 Developer Prompt by selecting "Developer PowerShell for VS 2019". However, it errors out and the icon is also missing. ### Actual Behavior I get the error: ``` Import-Module: Assembly with same name is already loaded Enter-VsDevShell: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'VsInstallPath'. Specified method is not supported. ``` Reasons: The Problem is with the Windows Terminal Profile settings. For that WT Profile, under commandLine it shows: ``` "commandline": "C:\\Program Files\\PowerShell\\7\\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}\"; cd ~", ``` If you have multiple versions of Visual Studio installed, the `vswhere.exe` will return an Array of items, so the PowerShell to register is incorrect. It needs to reference the first element of the `$vsPath` variable. This can be manually fixed by editing the settings and changing the line to: ``` "commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe -noe -c \"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationpath; Import-Module (Join-Path $vsPath[0] 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath[0] -SkipAutomaticLocation}\"; cd ~", ``` **Missing Icon** Also, for the missing Icon, the default install references the Icon under the Visual Studio "Enterprise". ``` "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png", ``` If you have Visual Studio "Professional" installed, the icon will break. Simply fix this by changing the line to: ``` "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Professional\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png", ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16824