On 8/20/08, Philip_L <[EMAIL PROTECTED]> wrote:
>
>             string assemblyName = "testAssembly";
>             AssemblyDefinition assembly =
>  AssemblyFactory.DefineAssembly(assemblyName, AssemblyKind.Dll);
>
>             var mainModule = new ModuleDefinition("MainModule",
>  assembly);
>             mainModule.Main = true;
>             assembly.Modules.Add(mainModule);
>
>             // Save the assembly and verify the result
>             AssemblyFactory.SaveAssembly(assembly, filename);

Actually DefineAssembly already adds a mainmodule to the assembly, so
you don't need to add a new one, and you can directly access it and
add types to it, that will create a correct assembly.

Cecil should throw an exception here though, as it doesn't know how to
emit multi module assemblies.

-- 
Jb Evain  <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to