When working on my MVC T4 template , I was not able to use reflection to discover the Controllers and Actions, because the code that the template generates is itself in the same assembly as the controllers. So that causes a bit of a chicken and egg problem. Instead, I had to get out of my element and learn something I was not familiar with: the Visual Studio File Code Model API. It?s very different from using reflection, because instead of working at the assembly level, you work at the source file level. You have to first locate the source file you want to look into. You can then ask for the namespaces that it contains, and the classes that they contain, and finally the various members in those classes. To be honest,...(read more) ...
Go to the complete details ...