From 75617322375cc84cf5e793db061012588c9bbe98 Mon Sep 17 00:00:00 2001 From: James Clancey Date: Tue, 13 Jul 2021 13:22:52 -0800 Subject: [PATCH 1/3] Added an option for `allow-prerelease` --- src/main.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.ts b/src/main.ts index 05035ca..693aac6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,12 +8,16 @@ import {ExecOptions} from '@actions/exec/lib/interfaces' const IS_WINDOWS = process.platform === 'win32' const VS_VERSION = core.getInput('vs-version') || 'latest' const VSWHERE_PATH = core.getInput('vswhere-path') +const ALLOW_PRERELEASE = core.getInput('allow-prerelease') || 'false' // if a specific version of VS is requested let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ' if (VS_VERSION !== 'latest') { VSWHERE_EXEC += `-version "${VS_VERSION}" ` } + if (ALLOW_PRERELEASE === 'true') { + VSWHERE_EXEC += ' --prerelease ' + } core.debug(`Execution arguments: ${VSWHERE_EXEC}`) From 4917605713e267783800672106cb335222279715 Mon Sep 17 00:00:00 2001 From: James Clancey Date: Tue, 13 Jul 2021 13:31:52 -0800 Subject: [PATCH 2/3] Allows `vs-prerelease` option Fixes #45 --- src/main.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.ts b/src/main.ts index 693aac6..1d238c5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,16 +8,21 @@ import {ExecOptions} from '@actions/exec/lib/interfaces' const IS_WINDOWS = process.platform === 'win32' const VS_VERSION = core.getInput('vs-version') || 'latest' 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 -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') { VSWHERE_EXEC += `-version "${VS_VERSION}" ` } - if (ALLOW_PRERELEASE === 'true') { - VSWHERE_EXEC += ' --prerelease ' - } core.debug(`Execution arguments: ${VSWHERE_EXEC}`) From 455ec54ae7025c970e5fc4dc9a14283e7298883f Mon Sep 17 00:00:00 2001 From: James Clancey Date: Tue, 13 Jul 2021 14:36:17 -0800 Subject: [PATCH 3/3] Always use -latest --- src/main.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main.ts b/src/main.ts index 1d238c5..6512bda 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,14 +11,10 @@ const VSWHERE_PATH = core.getInput('vswhere-path') const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false' // if a specific version of VS is requested -let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath ' +let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ' if (ALLOW_PRERELEASE === 'true') { VSWHERE_EXEC += ' -prerelease ' } -else -{ - VSWHERE_EXEC += ' -latest ' -} if (VS_VERSION !== 'latest') { VSWHERE_EXEC += `-version "${VS_VERSION}" `