.net dll version issue when replacing one dll

2019-05-03 22:09发布

问题:

I have the following problem. I created software, containing several projects in one solution. When I fix a bug in one of my projects which doesn't change how functions behave, (For example a simple string change, or an extra try/catch block within a function) I must recompile and provide all my dll's again, because when I only provide the changed dll, the version doesn't match. I understand that the problem is due to the fact that my dll's are strongly named. But is there any way to accomplish that I can just replace the changed dll, while the version number is raised, without changing and distributing the other dll's?

回答1:

You can have both dlls and can use bindingRedirect as in below link

dll versioning in dotnet

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="AssemblyName"
                              publicKeyToken="32ab4ba45e0a69a1"
                              culture="neutral" />
            <bindingRedirect oldVersion="1.0.0.0"
                             newVersion="2.0.0.0"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>