【发布时间】:2016-09-17 14:49:48
【问题描述】:
每次我在之前创建的 dll 程序集中调用 toJSONString() 方法时,调试器都会在 Visual Studio 的输出窗口中不断给我这个“System.IO.FileLoadException”错误消息。见下面的方法。我使用 NuGet 加载和引用 newtonsoft-json.dll 库,所以为什么运行时尝试不断失败是我无法理解的。
Object output;
...
public String toJSONString()
{
String strOut = "";
if (output != null)
{
strOut = JsonConvert.SerializeObject(output);
}
return strOut;
}
在“解决方案资源管理器”窗口的“参考”下,我检查了 Newtonsoft.Json 的路径,即 C:\temp2\DataTables_Examples\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll。该dll文件确实存在那里。我不知道为什么应用程序看不到它?任何帮助,将不胜感激。
【问题讨论】:
-
尝试清理并重建解决方案。
-
你试过
update-package Newtonsoft.Json -reinstall吗?
标签: c# json visual-studio dll json.net