Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.74] Added MinimumVisualStudioVersion env variable to force run-windows to use a particular version of VS installed #13380

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

jonthysell
Copy link
Contributor

@jonthysell jonthysell commented Jun 24, 2024

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 setting 17.11, (the version I'm trying to test for has fixes to #13339) the code was truncating it to 17.1. Even fixing the truncation meant that the build would later fail anyway, since it wasn't a X.0 number.

So this PR not only fixes the truncating code to keep 17.11 as 17.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

  • Bug fix (non-breaking change which fixes an issue)

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 force run-windows to use a particular version of VS installed

Microsoft Reviewers: Open in CodeFlow

…windows` to use a particular version of VS installed

This PR backports microsoft#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 setting `17.11`, (the version I'm trying to test for has fixes to microsoft#13339) the code was truncating it to `17.1`. Even fixing the truncation meant that the build would later fail anyway, since it wasn't a  `X.0` number.

So this PR not only fixes the truncating code to keep `17.11` as `17.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
- Bug fix (non-breaking change which fixes an issue)

### 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 force `run-windows` to use a particular version of VS installed
@jonthysell jonthysell requested review from a team as code owners June 24, 2024 22:54
@jonthysell jonthysell enabled auto-merge (squash) June 24, 2024 23:41
@jonthysell jonthysell merged commit a536616 into microsoft:0.74-stable Jun 26, 2024
95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants