0

I am trying to create a runtime text template for a .net core application, but I don't see TextTemplatingFilePreprocessor as a custom tool options in the properties pane. All I want to do is create a text template that will generate a text file with variables populated based on some input from the user

SampleMethod(string parameter1, string parameter2)
{
  string filetext = ProcessTemplate(string template, var parameters)
}
Walt
  • 119
  • 1
  • 11
  • This question is equivalent to asking recommendations on what text template engine to use at runtime, so should be closed as off-topic. There are tons of options, from [T4](https://github.com/mono/t4) to [Razor](https://antaris.github.io/RazorEngine/) if you use a search engine. – Lex Li Aug 27 '21 at 00:02
  • I'm using T4, but I can't see how to actually set the parameters in the code file – Walt Aug 27 '21 at 04:53
  • You can find several examples in https://stackoverflow.com/questions/59443320/call-mono-texttemplating-from-net-core-console-application – Lex Li Aug 27 '21 at 04:56
  • I figured it out, I must have not spelled the custom tool correctly – Walt Aug 30 '21 at 21:03

1 Answers1

1

Edit: Clarification, to create a runtime text template, you need to add a text template file in your solution explorer, then go to the properties of the template you have created and change the Custom tool property from TextTemplatingFileGenerator to TextTemplatingFilePreprocessor. you need to copy and paste the "TextTemplatingFilePreprocessor"

Walt
  • 119
  • 1
  • 11