Oh man... I ended up just hacking away at the ILRepack code and just
pulling over the Import functionality to get what I needed.  It works like
a champ, now!  I would use the ILRepack NuGet, but it doesn't support
assemblies that are in memory.

I now have that capacity to compile a full syntax tree with Roslyn, read it
as a binary format with Cecil, and then import the generated types in a
Fody Weaver on build via the pulled in code from ILRepack... all without
touching a line of IL.  I'm such a cheating hack, I know. :D  But it's
super nice now as I will be able to define AOT decorators for my
Xamarin.Forms applications (100% cross-platform compatible)... in C#, no
less. SWEEEEEEET.

The one thing I will have to look into is the performance/time with the
Roslyn compile... it's pretty chunky at ~800ms.

Once I have pushed/synced my code I will share here just in case anyone is
interested in the future.

Thanks again for all the amazing work in creating Cecil!!!

On Fri, Nov 28, 2014 at 1:54 PM, Michael DeMond <[email protected]>
wrote:

> Hello,
>
> Has there been any improvements/suggestions around this since this last
> thread post, by chance?  I am dynamically creating an assembly via Roslyn,
> then reading it into Cecil with a MemoryStream via
> AssemblyDefinition.ReadAssembly.  When I Remove the Type from its original
> (Roslyn) module definition, and then Add it to the created Cecil module
> definition, it does work, but I do end up getting a "Specified method is
> not supported." exception when the module writes out.
>
> Thanks for any insight you can provide.  I have a sinking feeling that I
> think I'm just going to have to learn IL after all. :P
> Michael
>
> On Tuesday, November 15, 2011 12:09:55 PM UTC-5, [email protected]
> wrote:
>>
>> Hi,
>>
>> I've been reading https://github.com/mono/cecil/
>> tree/master/merge/Mono.Merge
>> and I'm close to understanding it but I feel im missing something
>> rather simple...
>>
>> How can I copy a type from one assembly to another, currently I'm
>> doing this:
>>
>> var t = assemblyDefA.MainModule.GetType("some name");
>> assemblyDefB.MainModule.Types.Add(t);
>>
>> but I get "Type already attached".
>>
>> How can I achieve this?
>>
>> Thanks!
>
>  --
> --
> --
> mono-cecil
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "mono-cecil" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mono-cecil/Yt9xQedjw54/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to