1

After upgrading to .Net Core 3.1 in my Web API Project I tried this usual ef command -


dotnet ef

Got:

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.

Then found this - dotnet ef not found in .NET Core 3

Therefore, tried:

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

and got:

/usr/local/share/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v2/index.json 
/usr/local/share/dotnet/sdk/3.1.100/NuGet.targets(123,5): error :   Response status code does not indicate success: 400 (Bad Request). 
The tool package could not be restored.
Tool 'dotnet-ef' failed to install. This failure may have been caused by: ...

How to fix?

WickedW
  • 2,331
  • 4
  • 24
  • 54

1 Answers1

2

Found this -

Nuget connection attempt failed "Unable to load the service index for source"

So, then opened Nuget.config on MAC -

~/.nuget/Nuget/Nuget.config

And deleted all the URLs from in there.

Re-running

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

Worked :)

On re-using NUGET in a VS for MAC project (just added any Nuget), I was just left with

<configuration>
    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <packageSources>
</configuration>

Finally, realised had used ef tools 3.0.0, so finished updating ef tools with -

dotnet tool update --global dotnet-ef

WickedW
  • 2,331
  • 4
  • 24
  • 54
  • 1
    For Windows VS2019, you can do: tools | options | nuget pacakage manager | package sources UI to uncheck/disable that package feed – DharmaTurtle Jan 10 '20 at 16:37