我想在我的 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 跟踪。只是为了在您尝试执行此操作之前确保一切都清楚。
- 下载后,将压缩文件的内容解压到文件夹中。
- 您将看到两个目录,
Bin
和Source
.那个你 在意的是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/