'How To add new webapi project using powershell with specified version

when I used this command in powershell
dotnet new webapi -n NewCatalog
it creat a webapi project base on default version in my pc 2.2
I install .netcore 5 and try to use this command
dotnet new webapi -n NewCatalog --sdk-version 5.0.15 --force
But I fail
Invalid input switch:
--sdk-version
5.0.15
So How To add new webapi project using powershell with specified version



Solution 1:[1]

This command below can work for you to create a project with a specific .NET version.

 dotnet new webapi -f net5.0 -n NewCatalog

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lucas dos Santos Alves