c# - 无法安装 : Newtonsoft. Json

标签 c# windows-phone-8 nuget

我想在我的 Windows Phone 项目中下载和解析 JSON,所以我决定在 Visual Studios 中通过 Nuget 下载 newtonsoft.json 库,但我收到以下信息:

PM> Install-Package Newtonsoft.Json
Successfully installed 'Newtonsoft.Json 6.0.1'.
Successfully uninstalled 'Newtonsoft.Json 6.0.1'.
Install failed. Rolling back...

Install-Package : Could not install package 'Newtonsoft.Json 6.0.1'. You are trying to install this package into a project that targets 'WindowsPhone,Version=v8.0', but the package does not 
contain any assembly references 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

最佳答案

从这里下载组件(又名 DLL):http://james.newtonking.com/json

注意:确保删除您拥有的旧 Newtonsoft 组件的所有先前 Nuget 跟踪。只是为了在您尝试执行此操作之前确保一切都清楚。

  • 下载后,将压缩文件的内容解压到文件夹中。
  • 您将看到两个目录,BinSource .那个你 在意的是Bin目录。
  • 您会在 Bin 中找到其他目录,选择与您选择的框架相对应的那个。 .NET 3.5? 4.0?转发?
  • 您会找到 Newtonsoft.Json.dll将其复制到您项目的 bin位于项目的 Debug 内的目录文件夹。
  • 在 Visual Studio 中打开您的项目,右键单击 References Folder在您的项目名称下并选择 Add Reference
  • 点击 Browse并找到 Newtonsoft.Json.dll , 如有必要,点击应用,然后点击确定。

关于c# - 无法安装 : Newtonsoft. Json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21955598/

相关文章:

c# - 继承和new关键字

jquery - 流体布局,窗口的宽度在移动 (WP) 浏览器上未调整大小

powershell - PowerShell 可以在开发人员的工作站之间同步 Nuget 包吗?

c# - Windows Phone 8.1 应用构建中缺少 WMAppManifest.xml

Cordova WP8 bootstrap 字形图标未显示

c# - Visual Studio 2015 update 3 无法读取 NuGet 包

c# - 如何在 Visual Studio IDE 中查看来自 github 的源代码,但使用来自 Nuget 的 dll 进行编译?

c# - WPF 数据绑定(bind) : enable/disable a control based on content of var?

c# - 如何启用 dpiAware?

c# - 使用 httpwebrequest 调用 Web 服务方法 - 无法连接到远程服务器错误