首页 > 解决方案 > 如果 App 使用旧版本,如何在 DLL 中使用另一个版本的程序集

问题描述

我为应用程序(不是我的应用程序)开发了一个插件(WPF DLL)。我的插件使用 Newtonsoft.Json 和 Xceed.Wpf.Toolkit。一切正常。该应用程序的新版本现在带有这两个 DLL 的旧版本。经过多次搜索和尝试,我更改了应用程序的配置文件,如下所示:

原来的

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

新的

    ...
    <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
        <codeBase version="12.0.0.0" href="custom\Newtonsoft.Json.dll" />
    </dependentAssembly>
    <dependentAssembly>
        <assemblyIdentity name="Xceed.Wpf.Toolkit" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
        <codeBase version="4.0.0.0" href="custom\Xceed.Wpf.Toolkit.dll" />
    </dependentAssembly>
    ...

现在插件又开始工作了。但如果可能的话,我希望不要更改应用程序的配置文件。

除了这个还有其他可能吗?谢谢你。

标签: c#.netversion.net-assembly

解决方案


推荐阅读