Today, I was trying to add a new NuGet package to my .NET 5 project and I got the following error message: C:\Program Files\dotnet\sdk\5.0.301\NuGet.targets(131,5): error : The local source ‘C:\Users\Wolfgang\Desktop\poc-microservice-main\ProductService\ProductService.Catalog’ doesn’t exist. I know that the file doesn’t exist because I deleted it weeks ago after helping a reader of my blog.
I was quite annoyed by the error message because and I couldn’t find out what was wrong. Also checking the mentioned NuGet.targets file didn’t helpt me. Fortunately the solution was quite simple.
Open a PowerShell window and enter the following code:
dotnet new nugetconfig
This creates a new nuget.config file and fixed the problem for me.