Dotnet new mvc command not recognised

The dotnet new mvc command is used to create a new ASP.NET MVC project using the.NET CLI (Command-Line Interface). If the command is not recognized, it's likely because the.NET CLI is not installed or not properly configured on your system.

Here are some steps to troubleshoot the issue:

  1. Check if.NET Core is installed: Make sure you have.NET Core installed on your system. You can check by running the following command in your terminal or command prompt:

    dotnet --version

    If.NET Core is not installed, you can download and install it from the official.NET website: https://dotnet.microsoft.com/download

  2. Check if the.NET CLI is installed: Even if.NET Core is installed, the.NET CLI might not be installed. You can check by running the following command:

    dotnet tool install -g dotnet-new

    If the command is not recognized, you can install the.NET CLI by running the following command:

    dotnet tool install -g dotnet-cli
  3. Check your PATH environment variable: Make sure the.NET CLI is added to your system's PATH environment variable. You can check by running the following command:

    echo %PATH%

    If the.NET CLI is not in the PATH, you can add it manually by following these steps:

a. Right-click on the Start button and select System. b. Click on Advanced system settings. c. Click on Environment Variables. d. Under System Variables, scroll down and find the Path variable, then click Edit. e. Click New and enter the path to the.NET CLI executable (usually located at C:\Program Files\dotnet\sdk\3.1.401\dotnet.exe). f. Click OK to close all the windows.

  1. Try running the command again: After making sure the.NET CLI is installed and the PATH is correct, try running the dotnet new mvc command again.

If none of these steps resolve the issue, you can try reinstalling.NET Core or seeking further assistance from the.NET community or Microsoft support.