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
For mac I need to export the below path
Yes, give an example of the error:
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:
So, you should add $HOME/.dotnet/tools/ to your $PATH.
For Linux and macOS, add a line to the shell configuration:
bash/ zsh:
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.
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.