Reputation: 1
I tried installing Json.Net via NuGet using the command install-package newtonsoft.json
.
I got an error like the one shown below. How can I resolve this?
Install-Package Newtonsoft.Json
Installing 'Newtonsoft.Json 6.0.6'.
Successfully installed 'Newtonsoft.Json 6.0.6'.
Removing 'Newtonsoft.Json 6.0.3' from ReadJSON.
Successfully removed 'Newtonsoft.Json 6.0.3' from ReadJSON.
Adding 'Newtonsoft.Json 6.0.6' to ReadJSON.
Uninstalling 'Newtonsoft.Json 6.0.6'.
Successfully uninstalled 'Newtonsoft.Json 6.0.6'.
Install failed. Rolling back...
Install-Package : Could not install package 'Newtonsoft.Json 6.0.6'. You are trying to install this package into a project that
targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references or content files
that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Upvotes: 0
Views: 273
Reputation: 129687
Support for Windows Phone 7 and Silverlight 4 was removed from Json.Net in version 6.0 (source). If you still need to target WP7 / SL4, then you will need to use Json.Net v5.0.8 instead. You can install this by using the following command in the Package Manager console:
Install-Package Newtonsoft.Json -Version 5.0.8
Upvotes: 2