C# Newtonsoft.Json引用报错

************** 异常文本 **************
System.IO.FileLoadException: 未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
文件名:“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed” —> System.IO.FileLoadException: 未能加载文件或程序集“Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
文件名:“Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”

警告: 程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。
注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

在 ZD315.NET.WCS.FormMain.FormMain_Load(Object sender, EventArgs e)
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

在这里插入图片描述
程序引用版本是10.0.0.0的报错显示是13.0.0.0.0…

解决办法:
查看app.config文件是否一致在这里插入图片描述修改成引用版本一致即可解决!

  • 22
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
C#中,使用Newtonsoft.Json处理日期类型的方法是通过配置JsonSerializerSettings中的DateFormatString属性。可以使用以下代码示例来设置日期格式: ```csharp JsonSerializerSettings settings = new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss" }; string json = JsonConvert.SerializeObject(yourObject, settings); ``` 在上面的代码中,我们创建了一个JsonSerializerSettings对象,并将DateFormatString属性设置为所需的日期格式(例如"yyyy-MM-dd HH:mm:ss")。然后,我们可以使用JsonConvert.SerializeObject方法将对象序列化为JSON字符串,同时传递配置的JsonSerializerSettings对象。 请注意,你需要使用Newtonsoft.Json库,该库可以从官方网站下载并添加到你的项目中。确保在项目中包含Newtonsoft.Json.dll文件,并在代码中引用该库。 引用中提到了在SQL Server的CLR中使用Newtonsoft.Json进行比较的示例,这与在C#中处理日期类型的问题无关,请忽略该引用。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [SQLSERVER CLR借助Newtonsoft.JSON实现JSON内容是否相同对比功能](https://download.csdn.net/download/sugerlcc/85402800)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Newtonsoft.Json-for-Unity.Converters:Newtonsoft.Json的常见Unity类型的转换器。 与jilleJrNewtonsoft....](https://download.csdn.net/download/weixin_42112894/18775229)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [C# Newtonsoft.Json类库源码包](https://download.csdn.net/download/weixin_38658471/18584713)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值