Runtime Text Templates in Visual Studio 2019

820 Views Asked by At

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)
}
1

There are 1 best solutions below

2
On

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"