简体   繁体   English

无法加载文件或程序集 'Newtonsoft.Json,版本 = 12.0.0.0?

[英]Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0?

I have an issue in Newtonsoft.json library.我在 Newtonsoft.json 库中遇到问题。 When i try to run project using visual studio, it's working properly.当我尝试使用 Visual Studio 运行项目时,它工作正常。 But when i tried to create .exe on this, it shows a run time error但是当我尝试在此创建 .exe 时,它​​显示了一个运行时错误

    Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, 

Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependancies.

 The system cannot find the file specified.

In refereence and bin folder newsoft.json file available.在参考和 bin 文件夹中的 newsoft.json 文件可用。 Also in package folder also available.同样在包文件夹中也可用。 Why this error triggers only when i create .exe?为什么此错误仅在我创建 .exe 时触发? Please help me..请帮我..

.NET projects are not normally run as a standalone *.exe file. .NET 项目通常不会作为独立的 *.exe 文件运行。

You're choice is either create a setup project for your program or to copy the whole bin\\Release folder.您可以选择为您的程序创建安装项目或复制整个bin\\Release文件夹。 This folder should contain all the necessary non-standard libraries (the standard .NET libraries are provided by the operating system).此文件夹应包含所有必需的非标准库(标准 .NET 库由操作系统提供)。

I had the same problem, but my project was a console application made with .Net full, referencing another .Net standard project which had the NewntonSoft referenced.我遇到了同样的问题,但我的项目是一个使用 .Net full 制作的控制台应用程序,引用了另一个引用了 NewntonSoft 的 .Net 标准项目。 Both projects needs to use package management the same way.两个项目都需要以相同的方式使用包管理。 This article explains this better:这篇文章更好地解释了这一点:

https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx

尝试通过升级来匹配所有子项目上的包版本。

Installed Costura.Fody library file.安装 Costura.Fody 库文件。 Now its working as expected.现在它按预期工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“NewtonSoft.Json,版本=12.0.0.0” - Could not load file or assembly 'NewtonSoft.Json, Version=12.0.0.0' System.IO.FileNotFoundException: '无法加载文件或程序集 'Newtonsoft.Json,版本 = 12.0.0.0, - System.IO.FileNotFoundException: 'Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, 无法使用 Google.Apis 加载文件或程序集 'Newtonsoft.Json,版本 = 12.0.0.0 问题。* - Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0 issue using Google.Apis.* 在容器 dotnet 核心容器中运行时,无法加载文件或程序集“Newtonsoft.Json,版本 = 12.0.0.0” - Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0 when running in container dotnet core container 无法加载文件或程序集“Newtonsoft.Json”版本=11.0.0.0 - Could not load file or assembly 'Newtonsoft.Json' Version=11.0.0.0 无法加载文件或程序集'Newtonsoft.Json,版本 = 3.5.0.0 - Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0 无法加载文件或程序集Newtonsoft.json版本6.0.0.0 - Could not load file or assembly Newtonsoft.json Version 6.0.0.0 Newtonsoft.Json版本8.0.2无法加载文件或程序集错误 - Newtonsoft.Json version 8.0.2 Could not load file or assembly Error 无法加载文件或程序集 'Newtonsoft.Json,版本 = 10.0.0.0 - Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0 无法加载文件或程序集 'Newtonsoft.Json,版本 = 7.0.0.0 - Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM