I tried creating an assembly with Cecil using the following code:

            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);

..and when I ran PEVerify, this was the output:

Microsoft (R) .NET Framework PE Verifier.  Version  3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

[MD]: Error (Structural): Table=0x00000000, Col=0x00000002,
Row=0x00000002, has an invalid GUID offset.
1 Error(s) Verifying [NOTE: filename omitted]

Is there something that I'm doing wrong here? Other than adding a main
module to the assembly definition, what else do I have to do to
initialize the assembly definition to be valid? Thanks in advance.

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

Reply via email to