'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program

Viewed 1677

I am trying to add new field to my user table.

When I run Add-Migration newMigration, below error occurs.

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

ApplicationUser.cs

using System;

using Microsoft.AspNetCore.Identity;

namespace fublight_server.Authentication
{
    public class ApplicationUser:IdentityUser
    {
        public string FirstName { get; set; } // new field
        public string LastName { get; set; } // new field
    }
}

1 Answers

Try to see if you can use dotnet --version from command prompt. If it gives you the same error, you most likely have to add "C:\Program Files\dotnet" to your system path variables in order to be able to 'find' the command:

Environment variables - Path setting

You probably need a reboot after changing the environment variables.

Related