BindingRedirect到不同的程序集名称

发布于 2024-08-02 18:55:57 字数 259 浏览 3 评论 0原文

您可以使用 BindingRedirect 将 YourAssembly.dll 1.1.0.0 重定向到 1.2。 0.0。

有谁知道如果程序集名称不同是否可以这样做。

例如

YourAssembly1.dll (v1.1) 重定向到 YourAssembly2.dll (v2.8)

You can use BindingRedirect to redirect YourAssembly.dll 1.1.0.0 to 1.2.0.0.

Does anyone know if its possible to do this if the assembly names are different.

E.g.

YourAssembly1.dll (v1.1) redirects to YourAssembly2.dll (v2.8)

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

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

发布评论

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

评论(3

贪恋 2024-08-09 18:55:57

如果我没记错的话,我大约 4 年前使用 AppDomain 完成了此操作.AssemblyResolve 事件。这个想法是,您收到 AssemblyName 请求并返回一个 Assembly。在某些情况下,我什至能够在运行时生成 DynamicAssembly 并注入它。我忘记了强命名对此有何影响。

If I recall correctly, I did this about 4 years ago using the AppDomain.AssemblyResolve event. The idea is that you get the AssemblyName request and you return an Assembly. In some cases, I was even able to generate DynamicAssembly at runtime and inject that. I forget what effects strong naming has on this.

一向肩并 2024-08-09 18:55:57

使用 ILDASM 和 ILASM 反编译、修改和重新编译原始程序集,使其引用 YourAssembly2.dll。

我脑子里有了这个想法,并做了几次搜索来验证它的可能性。请参阅 是否可以修改程序集清单不是通过 ILDASM/ILASM 黑客攻击?http://forums .asp.net/t/1582934.aspx/1

Use ILDASM and ILASM to decompile, modify, and recompile the original assembly so it references YourAssembly2.dll.

I got the idea in my head and did a couple of searches to verify it's possible. See Is it possible to modify assembly manifests other than by ILDASM/ILASM hacking? and http://forums.asp.net/t/1582934.aspx/1

黎歌 2024-08-09 18:55:57

这应该是不可能的,因为您自己的应用程序引用了 YourAssembly1

当运行时加载您的应用程序时,它会尝试加载程序集 YourAssembly1.dll(应用探测和版本重定向),因此它无法加载程序集 YourAssembly2

This should not be possible, due to the fact that your own application has a reference to YourAssembly1.

When the runtime loads your application it tries to load an assembly YourAssembly1.dll (applying probing and version redirects) and therefore it cannot load the assembly YourAssembly2 instead.

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