版本冲突

编程入门 行业动态 更新时间:2024-10-28 17:23:16
本文介绍了版本冲突 - assembly.loadfrom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在运行时从应用程序加载多个dll。 例如如下所示。

I am trying to load multiple dlls from an application at runtime. For example like below.

Assembly assembly = Assembly.LoadFrom("MyNice.dll"); Type type = assembly.GetType("MyType"); object instanceOfMyType = Activator.CreateInstance(type); Assembly assembly = Assembly.LoadFrom("MyAnotherNice.dll"); Type type = assembly.GetType("MyType"); object instanceOfMyType = Activator.CreateInstance(type);

两个

Both

MyNice.dll and MyAnotherNice.dll

指的是具有不同版本的同一个库。说Reflib.dll和Reflib.dll。 问题:这是否可行,如果是,将如何解析

are referring to a same library with different versions. Say Reflib.dll and Reflib.dll. Question : Is this possible and if yes how will the versions of

Reflib.dll

库引用的版本运行时因为两个版本在功能上都有很大差异。 我尝试过: 我还没有真正尝试过这个,但我要求实现这一点,我确信我有这样的方案来处理。我正在寻找专业人士遵循或采用的最佳实践。

library reference will get resolved runtime as both the version has significant differences in functionality. What I have tried: I have not really tried this,but I have requirement to implement this and I am sure I have such scenario to handle. I am looking for the best practices professionals follow or adopt.

推荐答案

在这种情况下,我倾向于使用单独的AppDomains来保持良好和干净。我在前一段时间编写插件处理程序并使用AppDomains解决它以加载程序集及其依赖项时遇到了这种情况。 In this scenario, I would tend to use separate AppDomains to keep things nice and clean. I have encountered exactly this scenario when I wrote a plugin handler a while back and solved it using AppDomains to load the assemblies and their dependencies.

更多推荐

版本冲突

本文发布于:2023-11-13 11:45:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584276.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:冲突   版本

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!