9

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

mohammad ismael
  • 167
  • 5
  • 13

2 Answers2

18

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 ;)

Natanael Weslley
  • 333
  • 1
  • 2
  • 9
0

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
Aaron Hebert
  • 1
  • 1
  • 2
  • I know , I am just trying to add any package to learn how to use dotnet cli , I got this error : NU1100: Unable to resolve 'Newtonsoft.Json (>= 13.0.1)' for 'net5.0'. error: Package 'Newtonsoft.Json' is incompatible with 'all' frameworks in project 'C:\Users\moham\cs\cs.csproj'. – mohammad ismael Apr 27 '21 at 16:09
  • May I see a screenshot of what your .csproj file contains? That error sounds like something is being referenced that shouldn't be there. – Aaron Hebert Apr 27 '21 at 16:28
  • I added the screenshot ,can you please take a look on it , – mohammad ismael Apr 27 '21 at 16:51