VsDev: reject VS instances which do not actually contain devshell/devcmd (#19352)

Closes #19169

(cherry picked from commit 1926c4601c489ca724a8586242a667d52da8e45a)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzge0Hto
Service-Version: 1.24
This commit is contained in:
Dustin L. Howett 2025-09-16 15:24:10 -05:00 committed by Dustin L. Howett
parent 94e96ca048
commit 148a86c81c
2 changed files with 5 additions and 3 deletions

View File

@ -26,12 +26,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model
void GenerateProfiles(const VsSetupConfiguration::VsSetupInstance& instance, bool hidden, std::vector<winrt::com_ptr<implementation::Profile>>& profiles) const override;
private:
bool IsInstanceValid(const VsSetupConfiguration::VsSetupInstance&) const
bool IsInstanceValid(const VsSetupConfiguration::VsSetupInstance& instance) const
{
// We only support version of VS from 15.0.
// Per heaths: The [ISetupConfiguration] COM server only supports Visual Studio 15.0 and newer anyway.
// Eliding the version range will improve the discovery performance by not having to parse or compare the versions.
return true;
std::error_code ec;
return std::filesystem::exists(GetDevCmdScriptPath(instance), ec) && !ec;
}
std::wstring GetProfileGuidSeed(const VsSetupConfiguration::VsSetupInstance& instance) const

View File

@ -28,7 +28,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model
private:
bool IsInstanceValid(const VsSetupConfiguration::VsSetupInstance& instance) const
{
return instance.VersionInRange(L"[16.2,)");
std::error_code ec;
return instance.VersionInRange(L"[16.2,)") && std::filesystem::exists(GetDevShellModulePath(instance), ec) && !ec;
}
std::wstring GetProfileGuidSeed(const VsSetupConfiguration::VsSetupInstance& instance) const