我希望在我的Mac OS X上的一个简单的Visual Studio Code控制台应用程序中使用System.Runtime.Serialization.Json
,但我遇到了这个编译错误:
The type or namespace name 'Json' does not exist in the namespace 'System.Runtime.Serialization' (are you missing an assembly reference?)
基于这篇帖子 - Where is the System.Runtime.Serialization.Json namespace?,我将"System.ServiceModel.Web": "1.0.0"
添加到我的project.json文件中,但这没有帮助。我添加了1.0.0
,因为这是我在nuget中找到的唯一版本 - https://www.nuget.org/packages/System.ServiceModel.Web/
作为替代方案,我尝试使用https://www.nuget.org/packages/Newtonsoft.Json/6.0.8在我的project.json - "Newtonsoft.Json": "6.0.8"
中添加以下内容,但是再次添加using Newtonsoft.Json;
的引用会产生编译错误 - {{ 1}}
最终我想从我的VSCode控制台应用程序中取消json流,所以希望能够指出如何做到这一点?
答案 0 :(得分:2)
function getValue() {
var x = document.getElementById('image').title;
alert(x);
}
不会被移植到.Net Core;你去System.Runtime.Serialization.Json
做了正确的事。
很遗憾,您只将其添加到Newtonsoft.Json
部分;你需要将它添加到框架无关的依赖部分:
dnxcore50