简体   繁体   English

无法加载文件或程序集“NewtonSoft.Json,版本=12.0.0.0”

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

I'm new with C#.我是 C# 的新手。 I'm using C# in SSIS Script Component.我在 SSIS 脚本组件中使用 C#。

I installed Newtonsoft.Json from References-->Manage Nuget Packages .我从References-->Manage Nuget Packages安装了Newtonsoft.Json I added using Newtonsoft.Json;使用 Newtonsoft.Json 添加了; in the namespaces as well.在命名空间中也是如此。 The script was building successfully with 0 errors but one warning, " There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Microsoft.SqlServer.DTSRuntimeWrap, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. "脚本构建成功,出现 0 个错误,但有一个警告,“正在构建的项目的处理器架构“MSIL”与参考的处理器架构不匹配“Microsoft.SqlServer.DTSRuntimeWrap,版本=15.0.0.0,文化=neutral, PublicKeyToken=89845dcd8080cc91", "x86"。这种不匹配可能会导致运行时失败。请考虑通过配置管理器更改项目的目标处理器架构,以便在项目和引用之间对齐处理器架构,或者采取依赖关系关于与您项目的目标处理器架构相匹配的处理器架构的参考。

If I execute, the package fails with the error, " Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ".如果我执行,package 将失败并出现错误,“无法加载文件或程序集'Newtonsoft.Json,版本 = 12.0.0.0,文化 = 中性,PublicKeyToken = 30ad4fe6b2a6aeed 清单'或其依赖项定义不位于”匹配程序集引用。(来自 HRESULT 的异常:0x80131040) “。

I tried removing the Newtonsoft.Json reference, and adding it manually from References-->Add Reference-->Browse-->Add Newtonsoft.Json.dll , but it also didn't help.我尝试删除 Newtonsoft.Json 参考,并从参考手动添加它->添加参考->浏览->添加 Newtonsoft.Json.Z06416233FE5EC4C5933122AFE4AB248 ,但它也没有帮助。

Also, tried, Solution-->Properties-->Configuration Properties-->Configuration Manager-->And then changing the platform to x86 of the project's debug and release configurations , still it didn't help.另外,试过了, Solution-->Properties-->Configuration Properties-->Configuration Manager-->然后把平台改成项目调试和发布配置的x86,还是没用。

Badly need some help.非常需要一些帮助。 Thanks in Advance.提前致谢。

you can map the newtonsoft assembly to the required version in app.config like below.您可以在 app.config 中将 newtonsoft 程序集 map 转换为所需的版本,如下所示。

 <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>

暂无
暂无

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

相关问题 无法加载文件或程序集 &#39;Newtonsoft.Json,版本 = 12.0.0.0? - Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0? System.IO.FileNotFoundException: &#39;无法加载文件或程序集 &#39;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 无法加载文件或程序集 &#39;Newtonsoft.Json,版本 = 10.0.0.0 - Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0 无法加载文件或程序集 &#39;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