mohammad ismael
mohammad ismael

Reputation: 196

c# dotnet CLI "error: There are no versions available for the package 'Newtonsoft.Json'."

I am new to c# , I am trying to add package to my project I tried before to add "Microsoft.Toolkit.Uwp.Notifications" by dotnet cli dotnet add package Microsoft.Toolkit.Uwp.Notifications , and then tried to mimic Microsoft example Microsoft.Docs but it always shows this error , any help please?

info : Adding PackageReference for package 'Newtonsoft.Json' into project 'C:\Users\moham\cs\cs.csproj'. error: There are no versions available for the package 'Newtonsoft.Json'.

EDIT :

when I tried dotnet add package Newtonsoft.Json --version 13.0.1 I got this error : CMD error

Upvotes: 9

Views: 8067

Answers (2)

Natanael Weslley
Natanael Weslley

Reputation: 383

I had the same issue, I fix it running this command

dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

See this issue https://github.com/dotnet/sdk/issues/4156 for more details.

Hope this helps you ;)

Upvotes: 23

Aaron Hebert
Aaron Hebert

Reputation: 1

Welcome to the world of C#! While Microsoft.Toolkit.Uwp.Notifications doesn't appear to be dependent on Newtonsoft.Json, there may be another dependency in your project file. May I have you try adding Newtonsoft.Json FIRST, and then attempt to add the Mictrosoft.Toolkiy.Uwp.Notifications package afterwards?

dotnet add package Newtonsoft.Json --version 13.0.1
dotnet add package Microsoft.Toolkit.Uwp.Notifications --version 7.0.1

Upvotes: 0

Related Questions