I was trying to install the assembly System.IdentityModel.Tokens.Jwt, but I keep getting nuget errors:
find-package : No match was found for the specified search criteria and package name
'System.IdentityModel.Tokens.Jwt'. Try Get-PackageSource to see all available registered package sources.
When I download the .nupkg file directly and try to install it that way, I get the following error:
Install-Package : Unable to find dependent package(s) (Microsoft.IdentityModel.Tokens)
What am I doing wrong? I am a linux person normally so my instinct is that I am lacking the appropriate repositories, but I couldn't figure out how to resolve that issue.
That was a bit difficult to find, but here is my solution. If the Get-PackageSource
tells you that there is no NuGet registered as a package source then we register it first:
Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2
After that it should work.
I had another issue though. I did have NuGet registered but apparently, this PowerShell cmdlet expects to work with the v2 API version of NuGet, while I had v3 registered. There are 2 solutions to that: either re-register the correct version, for that
Unregister-PackageSource -Name nuget.org
(check the name first) and then register the correct version using the earlier command
OR
specify the correct API version in the Find (and other) commands explicitly:
Find-Package System.IdentityModel.Tokens.Jwt -Source https://www.nuget.org/api/v2
. There is an issue on Gihub that provides this solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With