Unable to compile template. The name 'Url' does not exist in the current context

Nov 10, 2014 at 1:21 PM
I am using RazorEngine to render out some basic content. It works great until I include any @Url syntax into markup.

If the markup contains an @Url I get the following error

Unable to compile template. The name 'Url' does not exist in the current context

Other compilation errors may have occurred. Check the Errors property for more information.

template = "Hello @Model.Name! @Url.Action(\"Preview\", \"Topics\") Welcome to Razor!";
string result = RazorEngine.Razor.Parse(template, new { Name = "World" });

What am I doing wrong?