error NU1301: Unable to load the service index for source

Steve Ellwood
2 min readMar 8, 2023

I’ve been battling with entity framework to try to get a database migrated from a local instance to Azure. The rest of that story is for another day, however I am creating a .net 6 application and wanted to run the ef commands from the command line. This is the dotnet tool for using entity framework.

When I tried to install using

dotnet tool install --global dotnet-ef

I got the error —

error NU1301: Unable to load the service index for source ...
The tool package could not be restored.
Tool '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

The link provided didn’t work for me, it just took me to Bing

Fortunately the solution in this case was very simple — the gist of it is that you need to delete the following file

%AppData%\Roaming\NuGet\NuGet.Config

So I opened up file explorer and put just the path part in but it didn’t like it for some reason, what it did let me do was open %AppData%\Roaming\ and then search using file explorer for Nuget.config. in my case it came up with a single file which I deleted and then the tool installed as expected.

--

--

Steve Ellwood

Senior Integrations Officer at Doncaster Council Any views expressed are entirely my own.