Microsoft has recently announced (and released, as part of WebMatrix) a new templating engine called Razor. Razor uses a parsing style which results in succinctly delineated template files. For example:
![]()
This will output:
- the contents of the name variable
- the current year
- and a link to the details page for a particular product.
Flow control statements are similar, delineated intelligently with braces:

Multi-line statements look like this:

Many have expressed concerns of wheel re-invention. While a valid concern, I feel it pales in comparison to the promise of progress and novel techniques that come with 1st party backing of an alternate, less verbose templating engine. For example: full IntelliSense support for alternate view engines is practically non-existent in projects like Spark or nhaml.
Recently, Scott Guthrie commented on a feature request, stating the Razor templating engine is very likely to have it’s source code released on CodePlex. Yup, just like MVC, MS is likely releasing the source. This is excellent news, since we can all take a stab at branching and improving Razor as we see fit.
As an aside, please see this blog post highlighting recently released .NET 4.0 libraries, now open source and completely compatible with the open source Mono project.
I’ve also read that Razor has a distinct lack of dependencies. Since the engine is simply generating strings from particular blocks of C# code, there is discussion of having Razor handle mail-merges, small-time business logic scripting, and so forth. It needn’t be married directly to the ASP.NET platform, or even the Web environment.
Bring it on!
