Attributes get compiled down to metadata, not program code.
If the compiler would actually execute any code you wrote this would be a huge security hole.
So in your case you can just write your own attribute and a custom verifier that gets called after the compiler (if you are using MS build this shouldn't be a problem)