Skip to content

Commit 3bdda34

Browse files
authored
Fix: findVisualStudio with pwsh constrained lang. mode
'Add-Type' cannot be used in powershell with constrained language mode. Language mode does not exist in PowerShell 2.0 engine. To force powershell to use 2.0 engine allows the usage of msvc 2017 or newer in environment with constrained language mode. See : https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/ https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-the-windows-powershell-2.0-engine?view=powershell-7.1
1 parent b7bccdb commit 3bdda34

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/find-visualstudio.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ VisualStudioFinder.prototype = {
129129
'WindowsPowerShell', 'v1.0', 'powershell.exe')
130130
var csFile = path.join(__dirname, 'Find-VisualStudio.cs')
131131
var psArgs = [
132+
'-Version',
133+
'2',
132134
'-ExecutionPolicy',
133135
'Unrestricted',
134136
'-NoProfile',

0 commit comments

Comments
 (0)