Receiving Events at Compile-Time?
How do you execute custom code at compile time? Is there an attribute you can use to markup a static method which is then executed on each build?
I'm pretty certain libraries like PostSharp an开发者_StackOverflowd Moles do something like this. Each of these appear to execute special compile-time routines for the projects they are referenced by.
EDIT: I am referring to the type of compilation done by visual studio, not JIT.
Many tools use Custom Build Events to handle updating and manipulating the build process. This is a fairly simple technique that can be used to put your own logic into the build process.
This doesn't look at your code -but you can write a program that uses reflection to analyze the assemblies post-build and do some logic.
精彩评论