AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

How do you change assembly level code? #5

Closed DamianReeves closed 8 years ago

DamianReeves commented 8 years ago

I want to do something like the following: https://github.com/Fody/ModuleInit Am I able to modify the class which does not directly allow me to place an attribute on it?

I'm trying to get this:

using System;
internal class <Module>
{
    static <Module>()
    {
        ModuleInitializer.Initialize();
    }
}
AArnott commented 8 years ago

The code generator emits C# to be compiled with the project. It doesn't let you overcome C# language barriers such as specifying module initializers. So I don't think this project is a good fit to replace cecil. Feel free to correct if I'm misunderstanding what you're asking for here.