Register t4 class in source control?

I want to use t4 to generate some text at runtime. I created a "runtime text template". I noticed that there is a .cs file that is being created from a .tt file. I am trying to find out if this is normally checked for initial control. I usually do not check the generated file. This file has a directive #linewith the full path to the file on my local machine. Checking this out just seems funny, since it obviously won't be the same on my machine on command.

+4
source share
2 answers

Your concern about the file name in the .cs file is very relevant, but in this case it is part of the compiler directive #line and it simply tells the compiler which file name to print on it when this file is processed.

Edit: Nice find from OP . For VS 2012, you can add the following directive to your template to remove LinePragmas. Further SO discussion here .

<#@ template language="C#" linePragmas="false" #>

I usually like to have files if they ...

  • Another developer or build agent is required to create the code.
  • Get deployed
  • Serve as documentation or any similar purpose
+4
source

, , , , . T4 , . , , - , -, T4 .

+3

Source: https://habr.com/ru/post/1535933/


All Articles