使用系统中已使用的其他第 3 方 (log4net) 的另一个版本的第 3 方的最佳方法是什么?

发布于 2024-09-25 23:33:16 字数 1004 浏览 0 评论 0原文

  • 目前我们使用版本 1.2.10.0 的 log4net,我们应该开始使用其他团队开发的一些 3rd 方组件。
  • 提到的组件引用了版本1.2.9.0的log4net。
  • 所有二进制文件都部署到一个文件夹中。

我确信我们无法使用 1.2.9.0 版本重建源代码,因为有太多其他依赖项,需要付出大量努力。还有其他方法可以解决这个问题吗?我并不是在寻找与 CLR 程序集加载有关的过于复杂的内容,但我会很高兴听到它们。我正在寻找最简单的方法。我猜有人遇到过同样的问题。

编辑: 如果有人感兴趣,我就此创建了博客文章: http://andriybuday.blogspot.com/2010/10/log4net -versions-deployment-issue.html

EDITED2:所以,这个编辑不是答案,但它代表了这个故事的意外结局。我刚刚从博客文章中复制了它。

这个故事的有趣结局

你知道这一切中最有趣的是什么吗?事情就是这样结束的。我们联系了那些开发了我们现在应该使用的组件的人。他们告诉我们,他们在更新 log4net 1.2.10.0 的动态配置文件时遇到问题。用他们的话说,新版本的 log4net 无法做到这一点。因此,他们发送了一个简单的应用程序来演示这一点,事实上,在应用程序运行时更新配置后,1.2.10.0 没有赶上新的配置,但 1.2.9.0 工作得很好。这让我非常惊讶,所以我去了这个下载页面并下载了最新的二进制文件。当我尝试时它起作用了!实际上我猜他们只是使用了 log4net buit 版本并引用了 .net Framework 1.1,我们应该使用用 .net 2.0 构建的版本(是的!实际上如果你下载你就会看到。)

在这一切之后,他们创建了新的版本他们特别为我们发布了他们的源代码,并且他们能够修复一些小错误。好消息!故事结局出乎意料! :)

  • Currently we use log4net of version 1.2.10.0 and we should start using some 3rd party components developed by other team.
  • Mentioned component references log4net of version 1.2.9.0.
  • All binaries are deployed into one folder.

I'm sure that we cannot rebuild our sources with 1.2.9.0 version, because there are too many other dependencies and will require lot of efforts. Are there any other approaches to solve this issue? I'm NOT looking for too sophisticated that have something to do with CLR assemblies loading, but would hear them with great pleasure. I'm looking for the simplest approaches. I guess someone has encountered the same issue.

EDITED:
If someone got interested I created blog post on this:
http://andriybuday.blogspot.com/2010/10/log4net-versions-deployment-issue.html

EDITED2: So, this edit is not answer, but it represents unexpected end of this story. I just copied it from blog post.

FUNNY-HAPPY-END OF THIS STORY

Do you know what is the most interesting about all of this? It is how it has finished. We contacted those guys, who developed component we now should use. They gave us know, that they were encountering issues with updating on-the-fly configuration file for log4net 1.2.10.0. By their words, new version of log4net is not capable of doing this. So they sent as simple application that demonstrates this, and indeed, after updating config when app is running, 1.2.10.0 did not catch up new configuration, but 1.2.9.0 was working just fine. This surprised me very much, so I went to this download page and downloaded latest binaries. When I tried it got working!!! Actually I guess that they simply used version of log4net buit with references to .net framework 1.1, and we should use one built with .net 2.0 (Yeah! Actually if you would download you will see.)

After all of this, they created new sub-release of their sources especially for us and they were able to fix some minor bug. Great news! Unexpected end of story! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无人问我粥可暖 2024-10-02 23:33:16

推荐的方法是将两个版本的 log4net 安装到全局程序集缓存 (GAC) 中。

但是,如果您无法更改从单个文件夹加载所有程序集的要求,则最简单的方法可能是重命名项目使用的 log4net 副本并引用重命名的版本。

The recommended approach would be to install both versions of log4net into the Global Assembly Cache (GAC).

If however you can't change the requirement of loading all assemblies from a single folder, it is probably easiest to rename the copy of log4net used by your projects and reference the renamed version.

眼眸里的那抹悲凉 2024-10-02 23:33:16

我不知道两个版本之间有什么变化(我们自己使用 1.2.10.0),但如果接口没有改变,那么你可以尝试程序集重定向到较新的版本:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="log4net"
                           publicKeyToken="b32731d11ce58905"
                           culture="neutral" />
         <bindingRedirect oldVersion="1.2.9.0"
                          newVersion="1.2.10.0"/>
       </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

确保密钥与我提供了一个,因为两者之间可能发生了变化。

http://msdn.microsoft.com/en-us/库/7wd6ex19(VS.71).aspx

I don't know what the changes are between the two versions (we use 1.2.10.0 ourselves) but if the interfaces have not changed then you could try an assembly redirect to the newer version:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="log4net"
                           publicKeyToken="b32731d11ce58905"
                           culture="neutral" />
         <bindingRedirect oldVersion="1.2.9.0"
                          newVersion="1.2.10.0"/>
       </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

Make sure that the key is the same as the one I provided as they may have changed between the two.

http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.71).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文