BindingRedirect到不同的程序集名称
您可以使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我没记错的话,我大约 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.
使用 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
这应该是不可能的,因为您自己的应用程序引用了
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 assemblyYourAssembly2
instead.