开发者

Receiving Events at Compile-Time?

开发者 https://www.devze.com 2023-04-05 09:48 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消