[0.74] Added MinimumVisualStudioVersion
env variable to force run-windows
to use a particular version of VS installed
#13380
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR backports #13373 to 0.74.
Description
Fixes a bug in
run-windows
where we truncate the minimum VS version number so it only allows for one digit minor versions.We try to detect when building inside a VS command prompt by looking for the
VisualStudioVersion
environment variable. In this way we can make sure to use specific (usually prerelease/preview) versions of VS.However, we can also set this env variable manually, which I was trying to do. However, there are lots of other places in VS that read this value, and it always expects a major version with a 0 minor version (i.e.
17.0
,18.0
). When setting17.11
, (the version I'm trying to test for has fixes to #13339) the code was truncating it to17.1
. Even fixing the truncation meant that the build would later fail anyway, since it wasn't aX.0
number.So this PR not only fixes the truncating code to keep
17.11
as17.11
, but also adds a new env variable to check for, i.e.MinimumVisualStudioVersion
, so that we can safely override that without breaking the build.Type of Change
Why
Trying to test with VS 17.11 preview, the number kept getting truncated to 17.1. I need a way of specify the version I want without breaking the build
What
Fixes the version range calculating code to not truncate the digits, adds new
MinimumVisualStudioVersion
env variable.Screenshots
N/A
Testing
Verified run-windows could fine the preview 17.11 over the regular 17.10 installed.
Changelog
Should this change be included in the release notes: yes
Added
MinimumVisualStudioVersion
env variable to forcerun-windows
to use a particular version of VS installedMicrosoft Reviewers: Open in CodeFlow