user3096803
user3096803

Reputation:

How can I generate plain old code from a text file on save with visual studio?

Many of the features in visual studio rely on editing a markup file and then saving it to auto-generate POC in C#.

For example, editing and saving a database *.dbml file will generate a *.designer.cs file that you can call from POC. It's also seen with ASP.Net *.aspx files, generating an *.aspx.designer.cs upon save so that the controls can be accessed in the codebehind files.

Is it possible to leverage this functionality in my own software so that I can define my own text files in CSV, JSON, or XML format and specify rules for generating code upon saving the file?

Upvotes: 1

Views: 133

Answers (1)

Hans Kesting
Hans Kesting

Reputation: 39329

The Visual Studio feature to generate code is called T4 Templating.

Upvotes: 2

Related Questions