We started using the Razor View Engine from Microsoft in preparation to switch to MVC 4 sooner or later.

Here are some introductory links:
Introduction to Razor Syntax
Quick Syntax Reference

There is an small OpenSource Engine which uses the Razor Parsing from the MVC Framework. This Engine is called RazorEngine.
It is available from two sources, development continues on GitHub but the version there is currently very unstable.
Here are the links:
http://razorengine.codeplex.com (2.x, stable)
https://github.com/Antaris/RazorEngine (3+, early version)

While using the Version 2.1, I got an

Predefined type ‘Microsoft.CSharp.RuntimeBinder.Binder’ is not defined or imported

Exception.
This seems to be a bug with Version 2.1, here’s the Discussion about it.

Actually there’s a really small workaround for it:
Just call

bool loaded = typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly != null;

before using

Razor.Parse

and you should be ready to go.

2 Comments


  1. REAL LIFE SAVER! Thank You!

  2. Zahid Rasool

    phew ! thanks man

Leave a Reply

Your email address will not be published.

*