In our project we've stumbled upon the following problem: we need to provide our developers two kinds of master pages (Razor-based and Webforms-based) each of which will generate exactly the same HTML output.
Our initial thought was to use the T4 templating engine and to have only one template which will spawn 2 files: *.master
and *.cshtml
where, for instance @using
Razor directive will correspond to <%@ Import ...
webforms statement.
The key idea is that HTML parts shouldn't be duplicated so obviously we cannot use the approach recommended in Generating more than one output file from a template or How to use T4 to generate two files at the same time from one template? because all the static content (plain HTML) in such a case will be duplicated.
Obviously I can write my custom T4 generator but it will be to sophisticated because there are too much directives (like "<%="
which will correspond to "@"
in Razor) on the pages.
Any other ideas on how I can accomplish this using any available templating engine?