Skip to content

Commit 7a71d68

Browse files
bzozrvagg
authored andcommitted
win: use msbuild from the configure stage
If node-gyp configure has set up MSBuild location use it instead the one that happens to be first on the PATH. PR-URL: #1654 Fixes: #1653 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: João Reis <[email protected]>
1 parent 45e3221 commit 7a71d68

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/build.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ function build (gyp, argv, callback) {
9595
*/
9696

9797
function doWhich () {
98+
// On Windows use msbuild provided by node-gyp configure
99+
if (win && config.variables.msbuild_path) {
100+
command = config.variables.msbuild_path
101+
log.verbose('using MSBuild:', command)
102+
doBuild()
103+
return
104+
}
98105
// First make sure we have the build command in the PATH
99106
which(command, function (err, execPath) {
100107
if (err) {
@@ -117,13 +124,6 @@ function build (gyp, argv, callback) {
117124
*/
118125

119126
function findMsbuild () {
120-
if (config.variables.msbuild_path) {
121-
command = config.variables.msbuild_path
122-
log.verbose('using MSBuild:', command)
123-
doBuild()
124-
return
125-
}
126-
127127
log.verbose('could not find "msbuild.exe" in PATH - finding location in registry')
128128
var notfoundErr = 'Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?'
129129
var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'

0 commit comments

Comments
 (0)