Unverified Commit 719268b4 authored by ekibun's avatar ekibun Committed by GitHub

add different workload & add -products * to vswhere calls to check both Visual...

add different workload & add -products * to vswhere calls to check both Visual Studio IDE and standalone Build Tools. (#64251)
parent 2d02c70a
...@@ -185,8 +185,12 @@ class VisualStudio { ...@@ -185,8 +185,12 @@ class VisualStudio {
/// Workload ID for use with vswhere requirements. /// Workload ID for use with vswhere requirements.
/// ///
/// Workload ID is different between Visual Studio IDE and Build Tools.
/// See https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids /// See https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids
static const String _requiredWorkload = 'Microsoft.VisualStudio.Workload.NativeDesktop'; static const List<String> _requiredWorkloads = <String>[
'Microsoft.VisualStudio.Workload.NativeDesktop',
'Microsoft.VisualStudio.Workload.VCTools'
];
/// Components for use with vswhere requirements. /// Components for use with vswhere requirements.
/// ///
...@@ -270,17 +274,19 @@ class VisualStudio { ...@@ -270,17 +274,19 @@ class VisualStudio {
Map<String, dynamic> _visualStudioDetails({ Map<String, dynamic> _visualStudioDetails({
bool validateRequirements = false, bool validateRequirements = false,
List<String> additionalArguments, List<String> additionalArguments,
String requiredWorkload
}) { }) {
final List<String> requirementArguments = validateRequirements final List<String> requirementArguments = validateRequirements
? <String>[ ? <String>[
'-requires', '-requires',
_requiredWorkload, requiredWorkload,
..._requiredComponents(_minimumSupportedVersion).keys ..._requiredComponents(_minimumSupportedVersion).keys
] ]
: <String>[]; : <String>[];
try { try {
final List<String> defaultArguments = <String>[ final List<String> defaultArguments = <String>[
'-format', 'json', '-format', 'json',
'-products', '*',
'-utf8', '-utf8',
'-latest', '-latest',
]; ];
...@@ -343,13 +349,18 @@ class VisualStudio { ...@@ -343,13 +349,18 @@ class VisualStudio {
_vswhereMinVersionArgument, _vswhereMinVersionArgument,
_minimumSupportedVersion.toString(), _minimumSupportedVersion.toString(),
]; ];
Map<String, dynamic> visualStudioDetails = _visualStudioDetails( Map<String, dynamic> visualStudioDetails;
validateRequirements: true, // Check in the order of stable VS, stable BT, pre-release VS, pre-release BT
additionalArguments: minimumVersionArguments); for (final bool checkForPrerelease in <bool>[false, true]) {
// If a stable version is not found, try searching for a pre-release version. for (final String requiredWorkload in _requiredWorkloads) {
visualStudioDetails ??= _visualStudioDetails( visualStudioDetails ??= _visualStudioDetails(
validateRequirements: true, validateRequirements: true,
additionalArguments: <String>[...minimumVersionArguments, _vswherePrereleaseArgument]); additionalArguments: checkForPrerelease
? <String>[...minimumVersionArguments, _vswherePrereleaseArgument]
: minimumVersionArguments,
requiredWorkload: requiredWorkload);
}
}
if (visualStudioDetails != null) { if (visualStudioDetails != null) {
if (installationHasIssues(visualStudioDetails)) { if (installationHasIssues(visualStudioDetails)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment