Error on QuickStart Sample Code - Method Not Found...

Feb 21, 2011 at 1:15 AM

I used NuGet to add RazorEngine to my project and added the demo code.  It throws an error on Razor.Parse.

Method not found: 'System.Web.Razor.GeneratorResults System.Web.Razor.RazorTemplateEngine.GenerateCode(System.IO.TextReader)'

I've checked the reference for System.Web.Razor and RazorEngine and they are both there.   What else am I missing here?


 string template = "Hello @Model.Name! Welcome to Razor!";
 string result = Razor.Parse(template, new { Name = "World" });

Feb 21, 2011 at 1:51 AM

I removed the references that was downloaded as a part of NuGet (as well as the zip that is downloaded here) and added a reference to the system.web.razor that is a part of mvc3.  This seems to have fixed it.

Coordinator
Feb 21, 2011 at 6:48 PM

Did you have the MVC3 RTM installed,or the Beta?

Feb 22, 2011 at 9:13 PM

To be honest I don't recall because I hadn't started doing any development in MVC3 and had installed it some time ago.  After reinstalling mvc3 and then using the system.web.razor reference for mvc (not the one from the zip) it fixed it.

Mar 6, 2011 at 7:58 AM

I even try to add new system.web.razor assembly from mvc folder, it still doesn't work at all

Coordinator
Mar 7, 2011 at 9:02 AM

@javafun, can you let me know the exact file versions that you have referenced to your project, as well as the version(s) of MVC3 you have installed?

Mar 7, 2011 at 10:26 AM

RazorEngine version 2.1.4039.23635

System.Web.Razor version 1.0.0.0  Path C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll