Skip to content

Commit 3807d86

Browse files
Update msbuildtools to detect both VS2022 and VS2026
Co-authored-by: protikbiswas100 <219775028+protikbiswas100@users.noreply.github.com>
1 parent ed042d7 commit 3807d86

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

packages/@react-native-windows/cli/src/commands/healthCheck/healthCheckList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const HealthCheckList = [
1111
[true, 'WindowsVersion', 'Windows version >= 10.0.17763.0'],
1212
[true, 'DeveloperMode', 'Developer mode is on'],
1313
[true, 'LongPath', 'Long path support is enabled'],
14-
[true, 'VSUWP', 'Visual Studio 2022 (>= 17.11.0) & req. components'],
14+
[true, 'VSUWP', 'Visual Studio 2022/2026 (>= 17.11.0) & req. components'],
1515
[true, 'Node', 'Node.js (LTS, >= 22.0)'],
1616
[true, 'Yarn', 'Yarn'],
1717
[true, 'DotNetCore', '.NET SDK (LTS, = 8.0)'],

packages/@react-native-windows/cli/src/utils/vsInstalls.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export function enumerateVsInstalls(opts: {
7272
if (opts.minVersion) {
7373
// VS 2019 ex: minVersion == 16.7 => [16.7,17.0)
7474
// VS 2022 ex: minVersion == 17.0 => [17.0,18.0)
75+
// VS 2026 ex: minVersion == 18.0 => [18.0,19.0)
76+
// To support both VS2022 and VS2026 with minVersion == 17.11.0 => [17.11.0,19.0)
7577

7678
// Try to parse minVersion as both a Number and SemVer
7779
const minVersionNum = Number(opts.minVersion);
@@ -82,12 +84,23 @@ export function enumerateVsInstalls(opts: {
8284

8385
if (minVersionSemVer) {
8486
minVersion = minVersionSemVer.toString();
85-
maxVersion = `${minVersionSemVer.major + 1}.0`;
87+
// Support VS2022 (17.x) and VS2026 (18.x) by extending max version range
88+
// If minVersion is 17.x, allow up to 19.0 to include both VS2022 and VS2026
89+
if (minVersionSemVer.major === 17) {
90+
maxVersion = '19.0';
91+
} else {
92+
maxVersion = `${minVersionSemVer.major + 1}.0`;
93+
}
8694
} else if (!Number.isNaN(minVersionNum)) {
8795
minVersion = Number.isInteger(minVersionNum)
8896
? `${minVersionNum}.0`
8997
: minVersionNum.toString();
90-
maxVersion = `${Math.floor(minVersionNum) + 1}.0`;
98+
// Support VS2022 (17.x) and VS2026 (18.x) by extending max version range
99+
if (Math.floor(minVersionNum) === 17) {
100+
maxVersion = '19.0';
101+
} else {
102+
maxVersion = `${Math.floor(minVersionNum) + 1}.0`;
103+
}
91104
} else {
92105
// Unable to parse minVersion and determine maxVersion,
93106
// caller will throw error that version couldn't be found.

0 commit comments

Comments
 (0)