When you use pwsh or powershell core (the newest version of powershell) you may face a problem regarding the compatibility with .NET 6.
Installing PowerShell on Windows – PowerShell | Microsoft Learn
PowerShell 7.3 installs to a new directory and runs side-by-side with Windows PowerShell 5.1. PowerShell 7.3 is an in-place upgrade that replaces PowerShell 7.0 and lower.
error NU1202: Package PowerShell 7.3.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0) / any. Package PowerShell 7.3.0 supports: net7.0 (.NETCoreApp,Version=v7.0) / any
The tool package could not be restored.
Tool ‘powershell’ failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the –version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
In order to resolve the error you should install .NET 7.
Download .NET 7.0 (Linux, macOS, and Windows) (microsoft.com)