From 7a71d68bce49cba73ef2a86e4febbcf840872834 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 13 Feb 2019 21:32:18 +0100 Subject: [PATCH] win: use msbuild from the configure stage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If node-gyp configure has set up MSBuild location use it instead the one that happens to be first on the PATH. PR-URL: https://github.com/nodejs/node-gyp/pull/1654 Fixes: https://github.com/nodejs/node-gyp/issues/1653 Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: João Reis --- lib/build.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/build.js b/lib/build.js index 363bd66a5f..eeaf680c6b 100644 --- a/lib/build.js +++ b/lib/build.js @@ -95,6 +95,13 @@ function build (gyp, argv, callback) { */ function doWhich () { + // On Windows use msbuild provided by node-gyp configure + if (win && config.variables.msbuild_path) { + command = config.variables.msbuild_path + log.verbose('using MSBuild:', command) + doBuild() + return + } // First make sure we have the build command in the PATH which(command, function (err, execPath) { if (err) { @@ -117,13 +124,6 @@ function build (gyp, argv, callback) { */ function findMsbuild () { - if (config.variables.msbuild_path) { - command = config.variables.msbuild_path - log.verbose('using MSBuild:', command) - doBuild() - return - } - log.verbose('could not find "msbuild.exe" in PATH - finding location in registry') var notfoundErr = 'Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?' var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'