Skip to content

Commit

Permalink
fix: find visual studio arm64 support
Browse files Browse the repository at this point in the history
This enables running find visual studio script on Windows on ARM64
  • Loading branch information
StefanStojanovic committed Mar 9, 2023
1 parent 39ac2c1 commit 3dceb59
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/find-visualstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,19 @@ VisualStudioFinder.prototype = {
// Invoke the PowerShell script to get information about Visual Studio 2017
// or newer installations
findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) {
var ps = path.join(process.env.SystemRoot, 'System32',
// SysWOW64 PowerShell is needed on ARM64 because of the COM classes and
// interfaces used by Find-VisualStudio.cs, which are not registered for
// being used from ARM64 processes.
//
// This fix is required for the clean installation of Windows 11. Old
// versions (e.g. Windows 10 upgraded to 11) work without it.
//
// Since VS v17.4 and later is natively supported on ARM64 it seems to
// register the ARM64 COM components correctly, but VS 2019 and 2017 will
// still have problems being detected. Once support for VS 2017 and 2019
// is dropped, this change can be restored.
var systemDirectory = process.arch === 'arm64' ? 'SysWOW64' : 'System32'
var ps = path.join(process.env.SystemRoot, systemDirectory,
'WindowsPowerShell', 'v1.0', 'powershell.exe')
var csFile = path.join(__dirname, 'Find-VisualStudio.cs')
var psArgs = [
Expand Down

0 comments on commit 3dceb59

Please sign in to comment.