dotnet tool install --global dotnet-ef

Viewed 2284

error NU1100: Unable to resolve 'dotnet-ef (>= 0.0.0)' for 'net5.0'. error NU1100: Unable to resolve 'dotnet-ef (>= 0.0.0)' for 'net5.0/any'. The tool package could not be restored. Tool 'dotnet-ef' failed to install. This failure may have been caused by:

  • You are attempting to install a preview release and did not use the --version option to specify the version.
  • A package by this name was found, but it was not a .NET tool.
  • The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
  • You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool error NU1100: Unable to resolve 'dotnet-aspnet-codegenerator (>= 0.0.0)' for 'net5.0'. error NU1100: Unable to resolve 'dotnet-aspnet-codegenerator (>= 0.0.0)' for 'net5.0/any'. The tool package could not be restored. Tool 'dotnet-aspnet-codegenerator' failed to install. This failure may have been caused by:

  • You are attempting to install a preview release and did not use the --version option to specify the version.
  • A package by this name was found, but it was not a .NET tool.
  • The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
  • You mistyped the name of the tool.
4 Answers

dotnet nuget list source returned an empty list. I guess you only run into this problem when you install dotnet without having visual studio installed on your machine that pre populates the official nuget site as source.

running dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org fixed the issue for me.

see https://github.com/dotnet/EntityFramework.Docs/issues/2044#issuecomment-910202971

Install it in your local project instead of globally, it will work for me. Execute the below commands one by one:

  1. dotnet new tool-manifest (this will dotnet-tools.json file in your project)
  2. dotnet tool install --local dotnet-ef --version 5.0.5
  3. dotnet ef

If you want to run this command in pc without Visual Studio installation , you must add a nuget source first by this command :

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

Try to install by including a version flag

dotnet tool install --global dotnet-ef --version 3.0.0
Related