Allows vs-prerelease option Fixes #45

This commit is contained in:
James Clancey 2021-07-13 13:31:52 -08:00 committed by GitHub
parent 7561732237
commit 4917605713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,16 +8,21 @@ import {ExecOptions} from '@actions/exec/lib/interfaces'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
const VS_VERSION = core.getInput('vs-version') || 'latest' const VS_VERSION = core.getInput('vs-version') || 'latest'
const VSWHERE_PATH = core.getInput('vswhere-path') const VSWHERE_PATH = core.getInput('vswhere-path')
const ALLOW_PRERELEASE = core.getInput('allow-prerelease') || 'false' const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false'
// if a specific version of VS is requested // if a specific version of VS is requested
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ' let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath '
if (ALLOW_PRERELEASE === 'true') {
VSWHERE_EXEC += ' -prerelease '
}
else
{
VSWHERE_EXEC += ' -latest '
}
if (VS_VERSION !== 'latest') { if (VS_VERSION !== 'latest') {
VSWHERE_EXEC += `-version "${VS_VERSION}" ` VSWHERE_EXEC += `-version "${VS_VERSION}" `
} }
if (ALLOW_PRERELEASE === 'true') {
VSWHERE_EXEC += ' --prerelease '
}
core.debug(`Execution arguments: ${VSWHERE_EXEC}`) core.debug(`Execution arguments: ${VSWHERE_EXEC}`)