app.config 程序集绑定似乎被忽略

问题描述

我有一个 c# 类库项目,其中包含对 Microsoft.Owin、Microsoft.IdentityModel 和 Microsoft.Graph 程序集的多个引用。 msbuild 命令返回版本冲突警告。

对于这些程序集,我发现 v6.5.0.0 与 v5.3.0.0 冲突:

Microsoft.IdentityModel.Tokens

Microsoft.IdentityModel.Protocols.OpenIdConnect

System.IdentityModel.TOkens.Jwt

Microsoft.IdentityModel.Protocols

我的 app.config 中有这个:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-6.5.0.0" newVersion="6.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.IdentityModel.Protocols" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-6.5.0.0" newVersion="6.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.IdentityModel.Protocols.OpenIdConnect" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-6.5.0.0" newVersion="6.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-6.5.0.0" newVersion="6.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
  </startup>
</configuration>

当我构建时,我仍然遇到版本冲突,好像它忽略了我的绑定重定向

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)