Is it possible to convert a single C# file to IL assembly?
Given a single c# source file, I'd like to output IL (not assembled) of that single file such that later I can feed each '.il' file to ilasm to produce assemblies, is th开发者_如何学JAVAis possible?
This isn't directly answering your question, but why not compile, then use ildasm and retrieve the relevant sections?
So, you probably can't do this well and in most cases you won't want to. However it is possible to cut compilation and assembly linking into two stages by building all sources to modules and then linking modules and resources into the final assemblies.
Short answer, getting textual IL out of a C# compiler is not feasible on .Net and in any case, there isn't much benefit from doing so.
精彩评论