Hi everyone,
I'm considering developing an executable that rewrites IL at build time probably usingCCI, similar to the Code Contracts rewriter, though mine has nothing to do with contracts. It has to do with something that is commonly solved by T4, though I need a solution that is language agnostic and requires little to no changes in the source in order to take advantage of its features, which is why I'm avoiding T4 in this scenario. I guess you could say it's a very narrowly-focused usage of AOP, though I don't want to use any existing AOP frameworks or depend on any third-party software (for good reasons).
1. My first concern is getting the post-processed IL to be shown in IntelliSense, within the same project being rewritten and all dependent projects.
For example, let's assume the rewriter injects a field into an existing class. In the code editor (e.g., C#), I should be able to place the text cursor in any method of the class and typethis. to get a completion list that includes the injected field.
I'm planning to extend the VS build system by introducing my own .targets file inMicrosoft.Common.targets. I'm doubtful whether that's enough for IntelliSense to reflect the rewritten assembly, because I assume that VS generates IntelliSense in the background by running its own internal build, which won't include my rewriter.
2. My other concern is debug symbols. I'm going to have to rewrite the .pdb file as well, which I believe CCI can do. But I'm wondering how Visual Studio's debugging experience will be affected, if at all.
Questions:
- Will introducing my own .targets file into the VS build process automatically give me up-to-date IntelliSense?
If not, then can I fix it with a custom VS editor extension?
If so, then where do I start gathering information on how to write a custom VS editor extension that extends IntelliSense?
Must I develop distinct VS editor extensions for each language that I want to support? (Defeats most of the purpose of IL rewriting though. In that case, I may actually resort to T4 and only target C#.) - Will pressing F5 to build, run and attach to the current process cause Visual Studio to automatically use the rewritten .pdb file in the project's output directory?
If not, then can I fix it with a custom VS editor extension?
If so, then where should I start researching? - Are there any examples of how to do something like this on MSDN?
Thanks,
Dave