无法加载文件或程序集'NewtonSoft.Json, Version=12.0.0.0'



我是c#新手。我在SSIS脚本组件中使用c#。

我安装了NewtonsoftJsonfromReferences——>Manage Nuget Packages. 我添加使用Newtonsoft.Json;在名称空间中也是如此。脚本构建成功,没有错误,但有一个警告,">正在构建的项目的处理器体系结构与"msl"不匹配。以及参考Microsoft.SqlServer的处理器体系结构。DTSRuntimeWrap, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, x86。这种不匹配可能导致运行时失败。请考虑通过配置管理器更改项目的目标处理器体系结构,以便使项目和参考之间的处理器体系结构保持一致,或者使用与项目的目标处理器体系结构匹配的处理器体系结构依赖于参考。">

如果我执行,包失败并出现错误,&;Could not load file or assembly 'Newtonsoft。Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(Exception from HRESULT: 0x80131040)"。

我试着移除Newtonsoft。Json引用,并手动从References->Add reference ->Browse->添加Newtonsoft.Json.dll,但也没有帮助。

也,试过了,Solution->Properties->Configuration Properties->Configuration Manager->然后将项目调试和发布配置的平台更改为x86

急需帮助。提前感谢。

你可以像下面这样将newtonsoft程序集映射到app.config中所需的版本。

<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>

最新更新