Dysfunctional autogenerated "VS 21" profiles for SQL Server Management Studio (SSMS) 21 #23472

Closed
opened 2026-01-31 08:43:18 +00:00 by claunia · 10 comments
Owner

Originally created by @KalleOlaviNiemitalo on GitHub (Jul 24, 2025).

Windows Terminal version

1.22.11141.0

Windows build number

10.0.26100.4652

Other Software

SQL Server Management Studio 21.4.8

Visual Studio Professional 2022 (64-bit) version 17.14.8

Visual Studio Professional 2017 version 15.9.75

Steps to reproduce

Open the profile menu. It includes "Developer Command Prompt for VS 21" and "Developer PowerShell for VS 21". Select one of them.

Expected Behavior

These profiles should not be generated, because SSMS 21 does not install the required files.

Or, if the profiles can be made to work properly, then their names should refer to "SSMS 21" rather than "VS 21".

Actual Behavior

"Developer Command Prompt for VS 21" opens a tab that shows an error:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

The command line of this autogenerated profile is:

cmd.exe /k "C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\VsDevCmd.bat" -startdir=none -arch=x64 -host_arch=x64

In settings.json, it is listed as:

            {
                "guid": "{9e69c0bf-d826-525c-b927-8e9006824867}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 21",
                "source": "Windows.Terminal.VisualStudio"
            },

"Developer PowerShell for VS 21" opens a tab that shows an error:

Import-Module : The specified module 'C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' was not loaded because no valid module file was found in any module directory.
At line:1 char:3
+ &{Import-Module "C:\Program Files\Microsoft SQL Server Management Stu ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Program File...io.DevShell.dll:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Enter-VsDevShell : The term 'Enter-VsDevShell' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:137
+ ... \Tools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell b218e7f ...
+                                                  ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Enter-VsDevShell:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The command line of this autogenerated profile is:

powershell.exe -NoExit -Command "&{Import-Module """C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell b218e7f4 -SkipAutomaticLocation -DevCmdArguments """-arch=x64 -host_arch=x64"""}"

In settings.json, it is listed as:

            {
                "guid": "{9b4e44dd-020d-5b00-a8ca-c5db6d969035}",
                "hidden": false,
                "name": "Developer PowerShell for VS 21",
                "source": "Windows.Terminal.VisualStudio"
            },
Originally created by @KalleOlaviNiemitalo on GitHub (Jul 24, 2025). ### Windows Terminal version 1.22.11141.0 ### Windows build number 10.0.26100.4652 ### Other Software SQL Server Management Studio 21.4.8 Visual Studio Professional 2022 (64-bit) version 17.14.8 Visual Studio Professional 2017 version 15.9.75 ### Steps to reproduce Open the profile menu. It includes "Developer Command Prompt for VS 21" and "Developer PowerShell for VS 21". Select one of them. ### Expected Behavior These profiles should not be generated, because SSMS 21 does not install the required files. Or, if the profiles can be made to work properly, then their names should refer to "SSMS 21" rather than "VS 21". ### Actual Behavior **"Developer Command Prompt for VS 21"** opens a tab that shows an error: ``` 'C:\Program' is not recognized as an internal or external command, operable program or batch file. ``` The command line of this autogenerated profile is: ``` cmd.exe /k "C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\VsDevCmd.bat" -startdir=none -arch=x64 -host_arch=x64 ``` In settings.json, it is listed as: ```JSON { "guid": "{9e69c0bf-d826-525c-b927-8e9006824867}", "hidden": false, "name": "Developer Command Prompt for VS 21", "source": "Windows.Terminal.VisualStudio" }, ``` **"Developer PowerShell for VS 21"** opens a tab that shows an error: ``` Import-Module : The specified module 'C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' was not loaded because no valid module file was found in any module directory. At line:1 char:3 + &{Import-Module "C:\Program Files\Microsoft SQL Server Management Stu ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (C:\Program File...io.DevShell.dll:String) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand Enter-VsDevShell : The term 'Enter-VsDevShell' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:137 + ... \Tools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell b218e7f ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Enter-VsDevShell:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException ``` The command line of this autogenerated profile is: ``` powershell.exe -NoExit -Command "&{Import-Module """C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell b218e7f4 -SkipAutomaticLocation -DevCmdArguments """-arch=x64 -host_arch=x64"""}" ``` In settings.json, it is listed as: ```JSON { "guid": "{9b4e44dd-020d-5b00-a8ca-c5db6d969035}", "hidden": false, "name": "Developer PowerShell for VS 21", "source": "Windows.Terminal.VisualStudio" }, ```
claunia added the Area-SettingsIssue-BugPriority-3Needs-Tag-FixProduct-Terminal labels 2026-01-31 08:43:19 +00:00
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Jul 24, 2025):

Within the C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools directory, there are only these files:

  • C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\vsdevcmd\core\msbuild.bat
  • C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\vsdevcmd\ext\diaghub.bat
  • C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\vsdevcmd\ext\team_explorer.bat

C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe does not list the SSMS instance.

@KalleOlaviNiemitalo commented on GitHub (Jul 24, 2025): Within the `C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools` directory, there are only these files: * C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\vsdevcmd\core\msbuild.bat * C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\vsdevcmd\ext\diaghub.bat * C:\Program Files\Microsoft SQL Server Management Studio 21\Release\Common7\Tools\vsdevcmd\ext\team_explorer.bat `C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe` does *not* list the SSMS instance.
Author
Owner

@DHowett commented on GitHub (Jul 24, 2025):

Uhh, that's not supposed to show up. We're using the same APIs vswhere uses. If you pass -all or -prerelease, does it show up?

@DHowett commented on GitHub (Jul 24, 2025): _Uhh,_ that's not supposed to show up. We're using the same APIs `vswhere` uses. If you pass `-all` or `-prerelease`, does it show up?
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Jul 24, 2025):

SSMS 21 doesn't show up with vswhere -all or vswhere -prerelease.

@KalleOlaviNiemitalo commented on GitHub (Jul 24, 2025): SSMS 21 doesn't show up with `vswhere -all` or `vswhere -prerelease`.
Author
Owner

@DHowett commented on GitHub (Jul 24, 2025):

Uh. I know @heaths mayn't own this area any longer, but he might have some ideas or people who do know.

@DHowett commented on GitHub (Jul 24, 2025): _Uh._ I know @heaths mayn't own this area any longer, but he might have some ideas or people who _do_ know.
Author
Owner

@heaths commented on GitHub (Jul 28, 2025):

I don't think SSMS uses the "new" VSSetup engine. @tydunkel?

@heaths commented on GitHub (Jul 28, 2025): I don't think SSMS uses the "new" VSSetup engine. @tydunkel?
Author
Owner

@heaths commented on GitHub (Jul 28, 2025):

Apparently it does, I'm told, but you need to use -products *. -all has nothing to do with the products listed. See -? for usage. But, IIRC (it's been a while since I added this code), Terminal uses the COM API not vswhere.exe. So the filtering would happen in Terminal. Just need to update that.

But I see the problem is that the dev shell assumes an instance has a dev shell. So maybe SSMS should be filtered out entirely.

@heaths commented on GitHub (Jul 28, 2025): Apparently it does, I'm told, but you need to use `-products *`. `-all` has nothing to do with the products listed. See `-?` for usage. But, IIRC (it's been a while since I added this code), Terminal uses the COM API not `vswhere.exe`. So the filtering would happen in Terminal. Just need to update that. But I see the problem is that the dev shell assumes an instance has a dev shell. So maybe SSMS should be filtered out entirely.
Author
Owner

@heaths commented on GitHub (Jul 28, 2025):

The change we're considering - and want to make sure this would meet the expectations - is to check if the startup script (batch or powershell) actually exists before generating a dev shell profile. That way we're not hardcoding a list of product IDs that assume a dev shell exists when, in fact, one may not have been installed based on the features installed for the instance or future changes to SKU design that may happen.

Sound reasonable?

@heaths commented on GitHub (Jul 28, 2025): The change we're considering - and want to make sure this would meet the expectations - is to check if the startup script (batch or powershell) actually exists before generating a dev shell profile. That way we're not hardcoding a list of product IDs that assume a dev shell exists when, in fact, one may not have been installed based on the features installed for the instance or future changes to SKU design that may happen. Sound reasonable?
Author
Owner

@DHowett commented on GitHub (Jul 28, 2025):

@heaths that's exactly what I was going to propose

@DHowett commented on GitHub (Jul 28, 2025): @heaths that's exactly what I was going to propose
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Jul 29, 2025):

Is the Visual Studio shell being used by any products other than VS itself and SSMS — especially any that might have files for a dev shell but should not be labeled "VS" in the Terminal UI?

I see Visual Studio 2015 had an "isolated shell" available for third-party applications but VS 2017 put a stop to that, so, I figure only Microsoft would publish products using newer versions of the VS shell.

@KalleOlaviNiemitalo commented on GitHub (Jul 29, 2025): Is the Visual Studio shell being used by any products other than VS itself and SSMS — especially any that might have files for a dev shell but should not be labeled "VS" in the Terminal UI? I see Visual Studio 2015 had an "isolated shell" available for third-party applications but VS 2017 put a stop to that, so, I figure only Microsoft would publish products using newer versions of the VS shell.
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Sep 10, 2025):

The current NuGet.exe 6.14.0.116 is likewise fooled:

MSBuild auto-detection: using msbuild version '17.14.23.42201' from 'C:\Program Files\Microsoft SQL Server Management Studio 21\Release\MSBuild\Current\bin'.

So NuGet doesn't have any specific SSMS exclusion logic that you could copy to Terminal.

NuGet tries to locate MSBuild on %PATH% before it resorts to Microsoft.VisualStudio.Setup.Configuration, so it does the right thing if started from a Developer Command Prompt. That isn't a feasible solution for Terminal, which is often started from the Start menu rather than from a command prompt.

@KalleOlaviNiemitalo commented on GitHub (Sep 10, 2025): The current NuGet.exe 6.14.0.116 is likewise fooled: > MSBuild auto-detection: using msbuild version '17.14.23.42201' from 'C:\Program Files\Microsoft SQL Server Management Studio 21\Release\MSBuild\Current\bin'. So NuGet doesn't have any specific SSMS exclusion logic that you could copy to Terminal. NuGet tries to locate MSBuild on `%PATH%` before it resorts to `Microsoft.VisualStudio.Setup.Configuration`, so it does the right thing if started from a Developer Command Prompt. That isn't a feasible solution for Terminal, which is often started from the Start menu rather than from a command prompt.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23472