Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target AppLocalFromInstalled: 'pwsh.exe' is not recognized as an internal or external command, operable program or batch file. #35270

Closed
oleg-boulanov opened this issue Nov 22, 2023 · 8 comments
Assignees
Labels
requires:more-information This Issue requires more information to solve

Comments

@oleg-boulanov
Copy link

oleg-boulanov commented Nov 22, 2023

Describe the bug
After installing vcpkg, new diagnostic output appeared while building existing projects

Environment

  • OS: Windows 11
  • Compiler: Visual Studio 2022/MSBuild

To Reproduce
Steps to reproduce the behavior:

  1. Install vcpkg
  2. Build existing static library C++ project in Visual Studio 2022
  3. Check build output window

Expected behavior
No errors logged

Failure logs
Target AppLocalFromInstalled: 'pwsh.exe' is not recognized as an internal or external command, operable program or batch file.


On my Windows 11, PowerShell shortcut points to:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
and is included in
Path=..;C:\Windows\System32\WindowsPowerShell\v1.0;...

@StarGate-One
Copy link
Contributor

vcpkg uses powershell-core pwsh.exe not windows powershell powershell.exe.
That said, vcpkg should have downloaded and installed the version of powershell core it requires - you can download/install powershell-core from here. Just be sure to select Add to Path for All Users when installing.
The version of powershell core used by vcpkg can be found here, looks like the x86 version of 7.2.11.
I personally have powershell-core 7.4 x64 with its path added and vcpkg finds it just fine.

@oleg-boulanov
Copy link
Author

Thank you for prompt response.
Maybe powershell-core should be listed as a prerequisite here: https://github.com/microsoft/vcpkg#quick-start-windows?

@StarGate-One
Copy link
Contributor

StarGate-One commented Nov 22, 2023

vcpkg should download/install the tools needed by the ports/features selected while being transparent to the user.

Listing the dozens of supporting tools vcpkg uses as prerequisite would be formidable, long and overwhelming, especially for new users to install, not to mention most would not be needed.

In this case vcpkg failed to download/install powershell-core and I am unsure what information/logs would be required to duplicate the issue and then remedy. The maintainers of this area of vcpkg may be reaching out to you for more information.

@oleg-boulanov
Copy link
Author

OK, thanks a lot!

@Adela0814
Copy link
Contributor

@oleg-boulanov Can you provide your simple reproduction project?

@Adela0814 Adela0814 added the requires:more-information This Issue requires more information to solve label Nov 23, 2023
@oleg-boulanov
Copy link
Author

@Adela0814 sorry, I can't.
StarGate-One already identified the issue - pwsh not installed during vcpkg installation:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && bootstrap-vcpkg.bat
I had to install it manually to fix the issue.

@rislah
Copy link

rislah commented Nov 29, 2023

Same. Manually installing fixed the issue.

@brett-m-rogers
Copy link

The other possibly bigger problem is that this doesn't fail the build. Is this target necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:more-information This Issue requires more information to solve
Projects
None yet
Development

No branches or pull requests

5 participants