'Dependency injection error pops up whenever I try to install a certain Discord Package
I'm really new to programming, but I felt like trying out some bot-development for my discord server, like one that will occasionally say hello to people when they join, however when I tried to install one of the Discord packages I got this error
Unable to resolve dependency 'Microsoft.Extensions.DependencyInjection'. Source(s) used: 'discord.net', 'Microsoft Visual Studio Offline Packages'.
Solution 1:[1]
Unable to resolve dependency 'Microsoft.Extensions.DependencyInjection'. Source(s) used: 'discord.net', 'Microsoft Visual Studio Offline Packages'.
This error message always occurs when you want to install the package whose dependency package is not found. For example, I created a custom package(MyCustomPKG
) that depends on Microsoft.Extensions.DependencyInjection
.
And now I'll get the same issue if nuget can't find the Microsoft.Extensions.DependencyInjection
in all available package sources.
To resolve that issue:
Add nuget.org
(https://api.nuget.org/v3/index.json) as package sources and make sure the checkbox is enabled.
In addition: If you're not using VS IDE, instead you're using Nuget.exe
+Nuget.config
file, add this line(<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
) to Nuget.config
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |