Just got the same error on Visual Studio 2022 using PowerShell Terminal. Fixed by switching the terminal from "Developer PowerShell" to "Developer Command Prompt".