skip to Main Content

I am using asp.net core 2.1 with visual studio code or rider in mac. I already have a 2.1 sdk install on mac, while using the below command

dotnet-ef database update --project XXXX.XXXX

I get an exception as

zsh: command not found: dotnet-ef

Using the command

dotnet tool install --global dotnet-ef

getting an exception as Tool 'dotnet-ef' is already installed.

Then using this command dotnet tool restore

error NU3037: Package 'dotnet-ef 3.1.1' from source 'https://api.nuget.org/v3/index.json': The repository countersignature validity period has expired.

Package "dotnet-ef" failed to restore, due to Microsoft.DotNet.ToolPackage.ToolPackageException: The tool package could not be restored.

3

Answers


  1. Chosen as BEST ANSWER

    For mac I need to export the below path

    export PATH="$PATH:$HOME/.dotnet/tools/"
    

  2. Yes, give an example of the error:

    $ dotnet ef
    Could not execute because the specified command or file was not found.
    Possible reasons for this include:
      * You misspelled a built-in dotnet command.
      * You intended to execute a .NET Core program, but dotnet-ef does not exist.
      * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
    

    The second and third refer to dotnet trying to find a dotnet-ef command but it cannot find it. As the third point said, dotnet-ef is not on your way.

    This is what the documentation says:

    Global tools can be installed in the default directory or in a specific location. The default directory is:
    
    OS Path
    
    Linux/macOS $HOME/.dotnet/tools
    
    Windows %USERPROFILE%.dotnettools
    

    So, you should add $HOME/.dotnet/tools/ to your $PATH.

    For Linux and macOS, add a line to the shell configuration:

    bash/ zsh:

    export PATH="$PATH:$HOME/.dotnet/tools/"
    

    When you start a new shell/terminal (or next time you log in) dotnet ef should work.

    For Windows:

    You need to add %USERPROFILE%.dotnettools to PATH.

    Login or Signup to reply.
  3. I am using asp.net core 6.0
    zhengguo@macdeMac-min % echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

    The PATH has already exist ~/.dotnet/tools
    When I use dotnet aspnet-codegenerator, it works. dotnet-aspnet-codegenerator not work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search