This project is read-only.

Razor Generator Precompilation failed - Error : The name'WriteAttribute' does not exists in the current context.

Mar 18, 2014 at 7:28 AM
Edited Mar 18, 2014 at 12:04 PM
We are implementing pre-compiled views in MVC3 App using the steps given in the following link

http://stacktoheap.com/blog/2013/01/19/precompiling-razor-views-in-asp-dot-net-mvc-3/

Installed versions :
Install-Package RazorGenerator.Mvc -version 2.1.0
Install-Package RazorGenerator.MsBuild -version 2.0.1

But after completing the steps and build the solution we get the error like.

Error 24 The name 'WriteAttribute' does not exist in the current context
at the line

WriteAttribute("src", Tuple.Create(" src=\"", 7), Tuple.Create("\"", 63)
        #line 1 "..\..\Views\Shared\_scriptTree.cshtml"
, Tuple.Create(Tuple.Create("", 13), Tuple.Create<System.Object, System.Int32>(Url.Content("~/Scripts/codebase/xxxxxxxxx.js")
        #line default
        #line hidden
, 13), false)
);

Could you please help me what I should do to resolve this exception?
Mar 18, 2014 at 12:53 PM
Some how the exception is vanished and build succeeded.
Mar 18, 2014 at 10:06 PM
Strange. It probably has to do with it not correctly detecting MVC3, and generating MVC4 or 5 code. But I don't know why it would be broken and then work.