替换一个DLL时,NET的DLL版本问题版本、问题、DLL、NET

2023-09-03 03:51:30 作者:温柔本仙

我有以下问题。我创建的软件,包含在一个解决方案的几个项目。当我修复我的一个项目中的错误表示不改变功能的行为,(例如一个简单的字符串的变化,或函数中一个额外的try / catch块)我必须重新编译,并提供所有的dll的一次,因为当我只提供了更改的DLL,该版本不匹配。据我所知,这个问题是由于这样的事实,我的DLL的强烈命名。但是,有没有办法做到,我可以只替换更改DLL,而版本号升高,而不改变和分发的其他DLL的?

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?

推荐答案

您可以有两个DLL文件,并且可以使用 bindingRedirect 作为下面的链接

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

在DOTNET DLL版本

<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>