crossvertise / ActionMailerNext

Fork of ActionMailer.Net, A easy to use library to generate emails with razor views
MIT License
42 stars 24 forks source link

Can't set html attributes - The name 'WriteAttribute' does not exist in the current context #5

Closed JamesReate closed 9 years ago

JamesReate commented 9 years ago

Hi, I'm using ActionMailerNext.Standalone v2 as from nuget, and when the app goes to try to compile the code, I get the following error: The name 'WriteAttribute' does not exist in the current context

The exception is of type RazorEngine.Templating.TemplateCompilationException and if I catch it, it shows 7 items in the Errors property and they all say the same thing but with different line numbers.

Any ideas? My .html.cshtml is pretty straightforward...

I noticed that as I remove Model properties from the cshtml, it reduces the number of WriteAttribute errors and that the number of errors is equivalent to the number of Model properties being output on the cshtml file.

JamesReate commented 9 years ago

I figured it out. This error occurs any time I try to set an html attribute like href="Model.mymodelproperty" or pretty much any html attribute. This is pretty lame, is there any workaround?

JamesReate commented 9 years ago

I upgraded to the nuget package in the pre release channel, which included an updated version of RazorEngine, which is where the problem was. After updating, it all works right!