Reputation: 4564
I've got a situation where I am using the 64-bit version of Visual Studio Code to write/debug a powershell script. However, because of what the Powershell script is doing it needs to run within the 32-bit version of Powershell. It's using some libs to access an MS Access file, so I have yet to find a way to make things work within Powershell x64.
Is there a way to tell VS Code to run the 32-bit version of Powershell if VS Code itself is running as 64-bit? For example, can I modify the launch.json file to specify the path of powershell itself?
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
...
]
}
Upvotes: 8
Views: 4902
Reputation: 1811
You can click the '{}' text in the bottom bar, then click on "Show PowerShell Session Menu".
This should give some different Powershell .exe options (x86 etc.) to choose from, depending on what is installed on the system.
Upvotes: 0
Reputation: 32155
Assuming you have the PowerShell extension installed, you should be able to modify the powershell.powerShellExePath
setting in VS Code Settings to "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
.
I believe you can also set "powershell.useX86Host": true
. This was introduced in the PowerShell extension v0.5.0; I'm not sure how I missed it's inclusion!
However, it might be easier or better to install the 64-bit MS Access components and just use the 64-bit version.
Microsoft Access Database Engine 2010 Redistributable
Microsoft Access Database Engine 2016 Redistributable
I've no idea why the 2013 version has a different name, but as far as I can tell those are the same components for the different versions.
Upvotes: 4
Reputation: 4564
I found another method that's easier and seems to be provided by VSCode (although it might be an extension I added). In the main window there's a clickable element in the right side of the toolbar:
When you click that a menu appears near the top of the window with some powershell related options, including the ability to switch between x86 and x64:
Upvotes: 15