What is a TT extension file for?

4

Well, I was searching the internet for a way to create a string as template , based on a template file. I came across a response from SOEN that talks about .tt files, to use a template at "runtime".

I'd like to know more about these files:

  • What is the .tt extension and how to use it?
  • What do I need to do to use it in Visual Studio, for example?
  • Is it safe to use it for what purposes? For example, I want to use to mount email body (use Webforms:).
asked by anonymous 27.07.2018 / 17:29

1 answer

6

This is a template file used by Visual Studio ( T4 ). It is used to create snippets code and other forms that give a basis for what you want to do.

It was used a bit more for code generation, but Roslyn ( .NET Compiler Platform ) Your necessity. Although it can be used as the basis for Roslyn to generate some code. Almost everything where it was needed has a better tool nowadays.

It was not exactly created for templates , but codes. But nothing prevents you from using it for your emails, just do not know if you have too much infrastructure ready for this, you will have to interpret it. nor do you have recent documentation for TextTransformation . More Visual Studio documentation . You have something a little newer .

I would use Razor with template for emails. In most cases, this does not even require a simple interpolation.

No more tool in Visual Studio.

Security depends on how you use it. Naively it can be insecure.

    
27.07.2018 / 18:05