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'