Skip to content

Commit 3dceb59

Browse files
fix: find visual studio arm64 support
This enables running find visual studio script on Windows on ARM64
1 parent 39ac2c1 commit 3dceb59

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/find-visualstudio.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,19 @@ VisualStudioFinder.prototype = {
126126
// Invoke the PowerShell script to get information about Visual Studio 2017
127127
// or newer installations
128128
findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) {
129-
var ps = path.join(process.env.SystemRoot, 'System32',
129+
// SysWOW64 PowerShell is needed on ARM64 because of the COM classes and
130+
// interfaces used by Find-VisualStudio.cs, which are not registered for
131+
// being used from ARM64 processes.
132+
//
133+
// This fix is required for the clean installation of Windows 11. Old
134+
// versions (e.g. Windows 10 upgraded to 11) work without it.
135+
//
136+
// Since VS v17.4 and later is natively supported on ARM64 it seems to
137+
// register the ARM64 COM components correctly, but VS 2019 and 2017 will
138+
// still have problems being detected. Once support for VS 2017 and 2019
139+
// is dropped, this change can be restored.
140+
var systemDirectory = process.arch === 'arm64' ? 'SysWOW64' : 'System32'
141+
var ps = path.join(process.env.SystemRoot, systemDirectory,
130142
'WindowsPowerShell', 'v1.0', 'powershell.exe')
131143
var csFile = path.join(__dirname, 'Find-VisualStudio.cs')
132144
var psArgs = [

0 commit comments

Comments
 (0)