我们可以在没有源代码的情况下向dll添加命名空间或类。 [英] Could we add a namespace or class to the dll without source code..

查看:79
本文介绍了我们可以在没有源代码的情况下向dll添加命名空间或类。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将新的vb代码包含到现有的dll中。 dll的源代码不能用于我们

How to include new vb codes into a existing dll. The source code of dll was not available with us

推荐答案

没有修改DLL文件就没有办法做到这一点。这样的事情是 System.Reflection.Emit 和CodeDOM允许在运行时创建代码并将其添加到同一运行时的当前进程,但此代码应该是全新的程序集或者所谓的动态方法,而不是类型。



现在,问题可能是假设有问题的DLL是一些有效的.NET部件。更准确地说,它可能是汇编模块之一,很可能只是某些汇编的唯一主要模块。如果是这样,您可以轻松地(如果它不包括一些保护)对其进行反向工程,在源代码中添加新代码并再次构建它。优秀的开源工具是ILSpy:

http://en.wikipedia.org/ wiki / .NET_Reflector [ ^ ](参见其他本文中的产品),

http://www.ilspy.net/ [ ^ ]。



然而,制作确定这个动作是合法的。 在没有源代码的情况下可能非法使用集会的所有法律后果是您自己的责任。在大多数立法领域,这些事情在某些条件下是合法的,但您应该小心这一点。 />


-SA
There is no a way to do it without modifying the DLL file. Such things are System.Reflection.Emit and CodeDOM allow to create code during runtime and add it to your current process in the same runtime, but this code should be the whole new assembly or a so called dynamic method, not the type.

Now, the question probably assumes that the DLL in question is some valid .NET assembly. More exactly, it could be one of the assembly modules, most likely, just the only main module of some assembly. If so, you can easily (if it does not include some protection) reverse engineer it, add new code in source code and build it again. The excellent open-source tool for that is ILSpy:
http://en.wikipedia.org/wiki/.NET_Reflector[^] (see other products in this article),
http://www.ilspy.net/[^].

However, make sure this action is legitimate. All legal consequences of possible illegal use of the assembly which comes without source code is your sole responsibility. In most domains of legislation such things are legal under certain conditions, but you should be careful about that.

—SA


这篇关于我们可以在没有源代码的情况下向dll添加命名空间或类。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆