windowspowershellvisual-studiovcpkg

vcpkg: `pwsh.exe` is not recognized as an internal or external command


I am a user of vcpkg C++ libraries manager on Windows 11, and recently I updated vcpkg to the latest tagged version 2024.01.12 (after removing an older version) using the commands:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
git checkout 2024.01.12
.\bootstrap-vcpkg.bat
.\vcpkg integrate install

And now in Visual Studio 2022, during building of my existing projects or even after creation of new Console App project, I get the error in Build Output windows:

1>'pwsh.exe' is not recognized as an internal or external command,
1>operable program or batch file.

But the build continues and succeeds.

Does it mean that the error is not important and safe to ignore? And even if so, what was wrong in the installation process or how can I silence this error?


Solution

  • This appears to be a bug in vcpkg. There's an issue on github that covers this:

    https://github.com/microsoft/vcpkg/issues/38502

    According to that issue this is the result of a recent change to vcpkg. Github user berryzplus proposed a solution and asked to make a PR, but there appears to be no further progress as of 2024/6/5.

    As far as I can tell, the error can be ignored. Since I only installed vcpkg to download and build libheif, I found that disabling vcpkg in the VS2022 project settings fixes the problem, at least for me it silenced the error message.

    Your actual mileage may vary. If you're using vcpkg for its intended purpose of package management, then disabling it may not be an option.

    Another possibility might be finding pwsh.exe and adding that to your PATH. No promises though.