runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Add T4 support

Open sergiyd opened this issue 9 years ago • 15 comments

There is no any code generation solution except of Razor, but it's coupled with web context. Add T4 support for code generation.

sergiyd avatar Aug 31 '17 15:08 sergiyd

I assume by T4 you mean Text Template Transformation Toolkit

While it sounds like useful idea, it feels out of scope of CoreFX repo. It also looks like larger, non-trivial work. I would suggest you to look for existing solutions and OSS projects.

karelz avatar Aug 31 '17 17:08 karelz

Honestly I'd prefer RazorTransorm as decoupled part of existing Razor Engine which takes text template with transformation model, understands @ as output and including (partial). Just thoughts. Thank you!

sergiyd avatar Aug 31 '17 17:08 sergiyd

@karelz this looks need to move to the sdk repro. agree?

tarekgh avatar Aug 31 '17 18:08 tarekgh

Why SDK? I was about to suggest Razor repo ... (I hope there is one)

karelz avatar Aug 31 '17 18:08 karelz

the request is to have code generation template can be used in VS. this is why I suggested SDK repo.

tarekgh avatar Aug 31 '17 18:08 tarekgh

Isn't VS just one of many users of such component? Or am I missing something?

karelz avatar Aug 31 '17 18:08 karelz

I am not sure the request is for VS only or not. I have no problem to move this to Razor as you suggested. anyway, this doesn't belong to corefx.

tarekgh avatar Aug 31 '17 18:08 tarekgh

@karelz do you know the exact Razor repo we can move the issue to?

tarekgh avatar Aug 31 '17 20:08 tarekgh

Quick internet search result: https://github.com/aspnet/Razor

karelz avatar Aug 31 '17 20:08 karelz

I saw that, but this repo is specific to CSHTML. I don't think this is the right place.

tarekgh avatar Aug 31 '17 20:08 tarekgh

IMO it is where Razor code lives. If there is request to decouple its component and generalize it to multi-purpose, it should be there as the closest place to the source code IMO. The other option is to fork entirely right away ... which would be starting brand new OSS project.

karelz avatar Aug 31 '17 20:08 karelz

I think the Razor request (decoupling, etc.) is not necessarily tied to the T4 request. Is that right, @sergiyd ?

From what I understand, the T4 engine has historically been a part of Visual Studio, and maintained by that team. I'm not sure if there's active development on it at the moment.

mellinoe avatar Aug 31 '17 21:08 mellinoe

@sergiyd you should make it clearer what exactly you would like to do.

T4 engine was tightly coupled with IDE. Microsoft's Visual Studio T4 implementation I think is not yet open sourced, so you probably could not reuse it easily in .NET Core.

MonoDevelop has their open source T4 clone for years, and if you like you can extract the goodies.

There are many third party options, such as ANTLR's StringTemplate (.NET Standard 1.3 compliant). They are also popularly used.

lextm avatar Aug 31 '17 22:08 lextm

@mellinoe @lextm as I understand T4 is separate utility which is well integrated in VS. Since Razor is already implemented in NET Core rather "reassign" this topic to https://github.com/aspnet/Razor. I'm going to try StringTemplate for now. Thanks!

sergiyd avatar Sep 01 '17 18:09 sergiyd

Closing it per the discussions result.

tarekgh avatar Sep 03 '17 01:09 tarekgh