The articles I have read on T4 using TextTemplatingFilePreprocessor show how to dynamically generate code that becomes part of a project, and is compiled with the project.
Is it possible to use T4 to generate code that is compiled at runtime, outputted to a dll, and loaded and executed, with said code having access the usual visibility capabilities associated with a dll?
If so, could you please point me to an example.
I'm effectively trying to do the same thing as generating a dynamic dll using IL, but rather using C#.
EDIT
The specific case I need this for is straightforward. I am writing a message router that routes messages to services. Services may be local or remote. A declarative script is compiled into C#. The dynamic part is "is this service local or remote?". The output C# is changed accordingly. The style of routing is different for local / remote, hence the dynamic nature.
This is one example of what I need.