diff --git a/dist/index.js b/dist/index.js index c71ae3e..d57919b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -977,7 +977,7 @@ const io = __importStar(__webpack_require__(1)); const IS_WINDOWS = process.platform === 'win32'; const VS_VERSION = core.getInput('vs-version') || 'latest'; const VSWHERE_PATH = core.getInput('vswhere-path') || - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer'; + path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer'); // if a specific version of VS is requested let VSWHERE_EXEC = ''; if (VS_VERSION === 'latest') { @@ -1017,7 +1017,7 @@ function run() { core.setFailed('setup-msbuild requires the path to where vswhere.exe exists'); } } - core.debug(`Full cached tool exe: ${vswhereToolExe}`); + core.debug(`Full tool exe: ${vswhereToolExe}`); let foundToolPath = ''; const options = {}; options.listeners = { @@ -1028,7 +1028,7 @@ function run() { } }; // execute the find putting the result of the command in the options foundToolPath - yield exec.exec(`${vswhereToolExe} ${VSWHERE_EXEC}`, [], options); + yield exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options); if (!foundToolPath) { core.setFailed('Unable to find msbuild.'); return; diff --git a/src/main.ts b/src/main.ts index a012975..e1228eb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,10 @@ const IS_WINDOWS = process.platform === 'win32' const VS_VERSION = core.getInput('vs-version') || 'latest' const VSWHERE_PATH = core.getInput('vswhere-path') || - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer' + path.join( + process.env['ProgramFiles(x86)'] as string, + 'Microsoft Visual Studio\\Installer' + ) // if a specific version of VS is requested let VSWHERE_EXEC = '' @@ -51,7 +54,7 @@ async function run(): Promise { } } - core.debug(`Full cached tool exe: ${vswhereToolExe}`) + core.debug(`Full tool exe: ${vswhereToolExe}`) let foundToolPath = '' const options: ExecOptions = {} @@ -64,7 +67,7 @@ async function run(): Promise { } // execute the find putting the result of the command in the options foundToolPath - await exec.exec(`${vswhereToolExe} ${VSWHERE_EXEC}`, [], options) + await exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options) if (!foundToolPath) { core.setFailed('Unable to find msbuild.')