Test.vbhtml
<span>The time is @DateTime.Now.</span>
@Helper Time()
@<p>The time is @DateTime.Now.</p>
End Helper
.注意句号末尾的句号 ( )@DateTime.Now
MVC3 接受Test.vbhtml. 行<span>和@Helper编译。
MVC4 仅在帮助程序中出现编译错误:
Compiler Error Message: BC30203: Identifier expected.
MVC4<span>中的 有效,但@Helper无效。
解决方案很简单,例如将句号替换为.. 但是为什么会这样呢?
为澄清而编辑。