I was trying to build a project on my machine this week, and it failed with a strange error message:

NuGet.targets(119,5): error : The local source ‘C:\Users\marti\source\repos\AwsConsoleApp3\ClassLibrary1’ doesn’t exist.

A Screenshot of the failed build 

I looked around but couldn’t understand why Nuget restore was looking for a ClassLibrary that I had written a few weeks ago.

I looked in a  file in my project folder called AWSLambda10.csproj.nuget.dgspec.json and noticed that there was a reference to the ClassLibrary there too. Weird I thought.

A screenshot of a csproj.nuget.dgspec.json configuration File

In that same file, there was a reference to a config File Path. I assumed this is from where default configuration was flowing.

A screenshot of the configFilePath element of a configuration file

I opened up that file C:\Users\marti\AppData\Roaming\NuGet\NuGet.Config peeked inside and saw the offending item.

The packageSources element of a NuGet.Config file

Accidentally a week or so ago I was experimenting with building NuGet packages, and I’d stupidly added a reference to a  Class Library to my NuGet package sources.

Every time NuGet ran It was trying to find this package source that was failing. I removed this line, my errors disappeared, and I was again able to build projects.