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

Closes #19169
This commit is contained in:
Dustin L. Howett 2025-09-16 15:24:10 -05:00 committed by GitHub
parent 46b9572e60
commit 1926c4601c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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