newton:~/Sources/temp jbevain$ monodis dummy.dll
.assembly 'dummy'
{
.hash algorithm 0x00000000
.ver 0:0:0:0
}
.module Dummy // GUID = {1764306C-0167-41BE-86B8-52ED3980F771}
Pretty simple assembly huh? Well, I've never been as happy to see the output of monodis. After three days of hard work, it is what Cecil produced while running this code:
using System; using Mono.Cecil; public class EntryPoint { public static void Main () { Console.WriteLine ("Running ..."); WriteDummyAssembly (); Console.WriteLine ("... Ended"); } public static void WriteDummyAssembly () { IAssemblyDefinition asm = AssemblyFactory.DefineAssembly ( "dummy", "Dummy", TargetRuntime.NET_1_1); AssemblyFactory.SaveAssembly (asm, "dummy.dll", AssemblyKind.Dll); } }
This does not looks very complicated but believe me, writing PE binary are neither simple nor fun. The good news is that both Mono and Cecil are able to read this assembly. I mean, Cecil can read assemblies it has produced, wow, isn't there some kind of beauty here ? The bad news is that Microsoft's Framework still throws me an error, but heh!
Ok ok, stop blogging, go back to work.