I am working on a T4 template generator for Visual Studio that supports the net core runtime. The following requirements are
- T4 templates using netstandard 2.0 or netstandard 2.1 function assemblies.
- Support the latest language compiler.
- Debug T4 Templates in visual studio.
- generate T4 templates in visual studio via custom tool
That being said, what VS 2019 provides out of the box:
- T4 Template engine running on the Framework runtime.
- Roslyn in process compiler is limited to C# 5.0.
- Visual studio uses remote services to execute the template generation in a T4 host process, to attach too and debug the template.
- netstandard 2.x function assemblies are not supported, at least I could never get them to work.
Some of the considerations I have to account for are:
- netcore and net 5, do not support AppDomain.
- The T4 text transformation compiled with rosyln can not process in the framework, will not load the System.Private.CoreLib. this requires that a host process exist not only to generate the code files but also to debug them as well.
- This also means that the T4HostProcess uses named pipes to communicate with Visual Studio. Is the Host Process the named pipe server or is it the client. I want to say the server, but I am not sure, that is why I am posting this on stack overflow.
- With the last statement, I am pretty sure that I have to find a way to facilitate cross domain communication using named pipes, between a .net core process and a framework process(visual studio). Remote services is not an option because it was built for framework and will not work for .net core.
Steps taken to arrive to a solution:
- using the Mono T4 template engine to compile the T4 Transform assembly, using the netcore runtime of Roslyn.
- I have been able to accomplish the following: custom tool, compile a T4 transformation assembly.
I would love to hear about any suggestions on how I can get this working. I am in the weeds with this and some of them look downright daunting.