具有两个单独的dll版本

问题描述 投票:1回答:1

我有一个Web表单应用程序,该应用程序在其自己的项目中的单独dll中具有所有业务逻辑。该dll需要具有两个不同的Newtonsoft.json版本。我已经尝试在网站web.config和dll app.config文件中使用以下代码,但是无法从指定文件夹加载该dll:s应用程序。我仍然收到消息:

“无法加载文件或程序集'Newtonsoft.Json,版本= 4.5.0.0,区域性=中性,PublicKeyToken = 30ad4fe6b2a6aeed'或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(HRESULT的异常:0x80131040)“

关于我可能在做错的任何想法?

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />-->

    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken ="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="4.5.0.0" newVersion="5.0.1.0" />
    <bindingRedirect oldVersion="5.0.2.0-99.0.0.0" newVersion="7.0.1.0" />
    <codeBase version="4.5.0.0" href="Bin/Newtonsoft.Json/5.0.1.0/Newtonsoft.Json.dll" />
    <codeBase version="5.0.1.0" href="Bin/Newtonsoft.Json/5.0.1.0/Newtonsoft.Json.dll" />
    <codeBase version="7.0.1.0" href="Bin/Newtonsoft.Json/7.0.1.18622/Newtonsoft.Json.dll" />

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

  </dependentAssembly>
</assemblyBinding>

已解决:在webconfig和appconfig <bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="7.0.1.0" />]中都添加以下内容

我有一个Web表单应用程序,该应用程序在其自己的项目中的单独dll中具有所有业务逻辑。该dll需要具有两个不同的Newtonsoft.json版本。我尝试使用以下代码...

.net dll
1个回答
1
投票

在webconfig和appconfig <bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="7.0.1.0" />中都添加以下内容>

© www.soinside.com 2019 - 2024. All rights reserved.