Fightning with .NET - 'unable to resolve' nuGet package errors
I’m not a developer in any sense of the word, but even I have to at least test run some code from time to time. In this case I was setting up a test environment for my upcoming Debezium session and got acquainted with some less-than-ideal error messages in .NET. I was trying to reference a few packages in my .CSPROJ file like so:
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="4.3.1" /> <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.0" />
but I kept hitting errors:
Unable to resolve 'Microsoft.Azure.WebJobs.Extensions.EventHubs (>= 5.0.1)' for 'net6.0'. error NU1100: Unable to resolve 'Microsoft.NET.Sdk.Functions (>= 4.1.0)' for 'net6.0'.
Googling these errors doesn’t really result in any help - especially if you’re not a developer. However, one forum response stood out, and that claimed that this specific error could be seen if nuGet for some reason had forgot all about where to find source packages. Let’s remind nuGet where the sources are:
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
dotnet clean dotnet build
…and what do you know.