Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 未能完成程序集的安装(FileLoadException)_Asp.net_.net Assembly_Nuget Package_Assembly Binding Redirect_Fileloadexception - Fatal编程技术网

Asp.net 未能完成程序集的安装(FileLoadException)

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

我很难弄清这个问题的真相。我的ASP.NET项目在
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>