![](/img/trans.png)
[英]Could not load file or assembly 'NewtonSoft.Json, Version=12.0.0.0'
[英]Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0?
我在 Newtonsoft.json 庫中遇到問題。 當我嘗試使用 Visual Studio 運行項目時,它工作正常。 但是當我嘗試在此創建 .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.
在參考和 bin 文件夾中的 newsoft.json 文件可用。 同樣在包文件夾中也可用。 為什么此錯誤僅在我創建 .exe 時觸發? 請幫我..
.NET 項目通常不會作為獨立的 *.exe 文件運行。
您可以選擇為您的程序創建安裝項目或復制整個bin\\Release
文件夾。 此文件夾應包含所有必需的非標准庫(標准 .NET 庫由操作系統提供)。
我遇到了同樣的問題,但我的項目是一個使用 .Net full 制作的控制台應用程序,引用了另一個引用了 NewntonSoft 的 .Net 標准項目。 兩個項目都需要以相同的方式使用包管理。 這篇文章更好地解釋了這一點:
https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx
嘗試通過升級來匹配所有子項目上的包版本。
安裝 Costura.Fody 庫文件。 現在它按預期工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.