Avoid assembly reference problems generally

前端 未结 1 1711
南旧
南旧 2021-01-16 22:06

I\'ve searched a lot but wasn\'t able to find a solution yet.

We have a lot of programs for our clients with shared libs (dlls) in one directory. But if one lib gets

相关标签:
1条回答
  • 2021-01-16 22:41

    What about assembly binding redirection - https://msdn.microsoft.com/en-us/library/433ysdt1(v=vs.110).aspx (one more msdn link) ?

    You can specify in the config redirection to a new version, so it wont require recompile. But if signature of classes\methods that you are using will be changed - then it will throw an exception anyway.

    ASP.Net MVC uses this approach to specify redirection to a new version of MVC:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    
    0 讨论(0)
提交回复
热议问题