mirror of
https://github.com/ilammy/msvc-dev-cmd.git
synced 2026-09-06 21:57:19 +08:00
Add support for VS2022 (#48)
Check $ProgramFiles too since that's where new stuff goes.
This commit is contained in:
@@ -5,9 +5,11 @@ const path = require('path')
|
|||||||
const process = require('process')
|
const process = require('process')
|
||||||
|
|
||||||
const PROGRAM_FILES_X86 = process.env['ProgramFiles(x86)']
|
const PROGRAM_FILES_X86 = process.env['ProgramFiles(x86)']
|
||||||
|
const PROGRAM_FILES = [process.env['ProgramFiles(x86)'], process.env['ProgramFiles']]
|
||||||
|
|
||||||
|
|
||||||
const EDITIONS = ['Enterprise', 'Professional', 'Community']
|
const EDITIONS = ['Enterprise', 'Professional', 'Community']
|
||||||
const VERSIONS = ['2019', '2017']
|
const VERSIONS = ['2022', '2019', '2017']
|
||||||
|
|
||||||
const VSWHERE_PATH = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\Installer`
|
const VSWHERE_PATH = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\Installer`
|
||||||
|
|
||||||
@@ -32,9 +34,10 @@ function findVcvarsall() {
|
|||||||
|
|
||||||
// If that does not work, try the standard installation locations,
|
// If that does not work, try the standard installation locations,
|
||||||
// starting with the latest and moving to the oldest.
|
// starting with the latest and moving to the oldest.
|
||||||
|
for (const prog_files of PROGRAM_FILES) {
|
||||||
for (const ver of VERSIONS) {
|
for (const ver of VERSIONS) {
|
||||||
for (const ed of EDITIONS) {
|
for (const ed of EDITIONS) {
|
||||||
path = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
|
path = `${prog_files}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
|
||||||
core.info(`Trying standard location: ${path}`)
|
core.info(`Trying standard location: ${path}`)
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
core.info(`Found standard location: ${path}`)
|
core.info(`Found standard location: ${path}`)
|
||||||
@@ -42,6 +45,7 @@ function findVcvarsall() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
core.info("Not found in standard locations")
|
core.info("Not found in standard locations")
|
||||||
|
|
||||||
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||||
|
|||||||
Reference in New Issue
Block a user