How to load a .net module without the assembly manifest

梦想的初衷 提交于 2019-12-11 19:14:48

问题


How can I load a .net module(just a normal assembly except it doesn't contain assembly manifest) without the need of the manifest? I have some assemblies that throws this error when I try to run them:

The module was expected to contain an assembly manifest

Normally I can fix this problem by recompiling the assembly using ilasm after adding the assembly manifest:

.assembly test{  }

But is there other work around for this problem? Can Assembly.LoadModule(...) fix my problem?


回答1:


Manifest is a part of an logical assembly which may consist of many files. And only single of them contains assembly manifest(where are links to all other assembly files), so you can make try-catch block and load successfully only the main assembly modules.



来源:https://stackoverflow.com/questions/12679371/how-to-load-a-net-module-without-the-assembly-manifest

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!