0

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?

kmatyaszek
  • 19,016
  • 9
  • 60
  • 65
method
  • 1,369
  • 3
  • 16
  • 29
  • That's not possible. A .netmodule is just an intermediate file, it doesn't get usable until it is linked to produce an assembly. – Hans Passant Oct 01 '12 at 19:15
  • Well, "the way I was able to get such assembly was from a memory dump of a packed assembly.". The packer uses LoadModule method to execute the main assembly without containing the assembly manifest. Is it possible with LoadModule? – method Oct 01 '12 at 19:21

1 Answers1

0

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.

FLCL
  • 2,445
  • 2
  • 24
  • 45
  • I don't get what you mean by 'try-catch block and load only the main assembly modules', the way I was able to get such assembly was from a memory dump of a packed assembly. The problem is the manifest is missing. – method Oct 01 '12 at 19:14
  • @Furious I thought you had a directory with a number of assemblies and tried to load them by file names. Try-catch block can be made for you assembly load code, so assemblies with manifest will be loaded and assemblies without it will not, but without stopping of scanning for assembly files. – FLCL Oct 01 '12 at 19:19