2
2
3
3
const log = require ( 'npmlog' )
4
4
const execFile = require ( 'child_process' ) . execFile
5
+ const fs = require ( 'fs' )
5
6
const path = require ( 'path' ) . win32
6
7
const logWithPrefix = require ( './util' ) . logWithPrefix
7
8
const regSearchKeys = require ( './util' ) . regSearchKeys
@@ -257,22 +258,31 @@ VisualStudioFinder.prototype = {
257
258
ret . versionYear = 2019
258
259
return ret
259
260
}
261
+ if ( ret . versionMajor === 17 ) {
262
+ ret . versionYear = 2022
263
+ return ret
264
+ }
260
265
this . log . silly ( '- unsupported version:' , ret . versionMajor )
261
266
return { }
262
267
} ,
263
268
264
269
// Helper - process MSBuild information
265
270
getMSBuild : function getMSBuild ( info , versionYear ) {
266
271
const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base'
272
+ const msbuildPath = path . join ( info . path , 'MSBuild' , 'Current' , 'Bin' , 'MSBuild.exe' )
267
273
if ( info . packages . indexOf ( pkg ) !== - 1 ) {
268
274
this . log . silly ( '- found VC.MSBuild.Base' )
269
275
if ( versionYear === 2017 ) {
270
276
return path . join ( info . path , 'MSBuild' , '15.0' , 'Bin' , 'MSBuild.exe' )
271
277
}
272
278
if ( versionYear === 2019 ) {
273
- return path . join ( info . path , 'MSBuild' , 'Current' , 'Bin' , 'MSBuild.exe' )
279
+ return msbuildPath
274
280
}
275
281
}
282
+ // visual studio 2022 don't has msbuild pkg
283
+ if ( fs . existsSync ( msbuildPath ) ) {
284
+ return msbuildPath
285
+ }
276
286
return null
277
287
} ,
278
288
@@ -293,6 +303,8 @@ VisualStudioFinder.prototype = {
293
303
return 'v141'
294
304
} else if ( versionYear === 2019 ) {
295
305
return 'v142'
306
+ } else if ( versionYear === 2022 ) {
307
+ return 'v143'
296
308
}
297
309
this . log . silly ( '- invalid versionYear:' , versionYear )
298
310
return null
0 commit comments