Asp.net 未能完成程序集的安装(FileLoadException)
我很难弄清这个问题的真相。我的ASP.NET项目在Asp.net 未能完成程序集的安装(FileLoadException),asp.net,.net-assembly,nuget-package,assembly-binding-redirect,fileloadexception,Asp.net,.net Assembly,Nuget Package,Assembly Binding Redirect,Fileloadexception,我很难弄清这个问题的真相。我的ASP.NET项目在Newtonsoft.Json 10.0.3上有一个Nuget包依赖项,并且在同一个解决方案中有一个对类库项目的项目引用。ASP.NET项目在web.config文件中还具有以下绑定重定向 <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
Newtonsoft.Json 10.0.3
上有一个Nuget包依赖项,并且在同一个解决方案中有一个对类库项目的项目引用。ASP.NET项目在web.config文件中还具有以下绑定重定向
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
将web.config文件中的绑定重定向更改为以下内容可修复此问题
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
但是,强制运行时版本为6.0.0.0
似乎并不理想,因为解决方案中的其他项目也依赖10.0.3
。请注意,将相关类库更新为10.0.3
也不能解决此问题。仅更改绑定重定向
有什么想法吗?为什么类库引用了与asp.net项目不同的Newtonsoft版本?这里是我的建议:去类库的包管理器。卸载Newtonsoft软件包。搜索最新的Newtonsoft软件包,下载/安装它。或者,您可以在类库中更新已安装的Newtonsoft版本 它不是对Newtonsoft的直接依赖,而是通过另一个包的间接依赖。
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>