What you see is the result of assembling the assembly. When you emit assemblies using the System.Reflection API, there is no easy way to avoid leaking metadata references (such as type) from your environment to the final assembly. This is because SR Api was intended to generate a run-time code, and not to generate some result to save.
You can try using something like Mono.Cecil, which is much more suitable for this purpose.
source
share