Search code examples
powershellvisual-studio-2022

How to enable the x86 version of Developer PowerShell for VS 2022


In earlier versions of Visual Studio it used to have both x86 and x64 versions for the Developer PowerShell. In the 2022 version, it only has the x64 version. How can I enable the x86 version? Thank you.

I tried to run "Windows PowerShell (x86)" and then run vcvars32.bat on it. Although it says Environment initialized for: 'x86' but for example does not recognize nmake. While nmake is recognized in the x64 Developer PowerShell.


Solution

  • In earlier versions of Visual Studio it used to have both x86 and x64 versions for the Developer PowerShell.

    I think you have a false-memory there, because I have VS2019 installed and there's only 1 VS2019 PowerShell shortcut, and it isn't labelled for x86 nor x64.

    In the 2022 version, it only has the x64 version.

    The VS2022 PowerShell start-menu shortcut isn't labelled x64 (or x86) either:

    VS2019 VS2022
    enter image description here enter image description here
    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -noe -c "&{Import-Module """C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell 7d25e381}" C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -noe -c "&{Import-Module """C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell 3537ba3e}"

    I tried to run "Windows PowerShell (x86)" and then run vcvars32.bat on it. Although it says Environment initialized for: 'x86' but for example does not recognize nmake. While nmake is recognized in the x64 Developer PowerShell.

    vcvars32.bat is for cmd.exe, not PowerShell.

    Re: nmake, that's best run under cmd.exe instead of PowerShell anyway; so the separate x86 and x64 (and ARM) start-menu shortcuts for those are just what you need.

    FWIW, you can still use the x64 version of nmake to target 32-bit x86, just set the right environment-variables;