@helper指令在ASP.NET5 MVC6 beta4中不再可用. [英] @helper directive no longer works out of the box in ASP.NET5 MVC6 beta4.

查看:96
本文介绍了@helper指令在ASP.NET5 MVC6 beta4中不再可用.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我将ASP.NET5项目更新为 beta4 (Visual Studio 2015 RC附带的项目)以来,我在任何使用助手的Razor视图中,例如:

Since I updated my ASP.NET5 project to beta4 (the one included with Visual Studio 2015 RC), any of my Razor views where I use a helper, such as:

@helper foo()
{
   <h2>Bar</h2>
}

导致以下错误:

错误CS0103:名称'helper'在当前上下文中不存在.

是否不再支持@helper指令?有人可以给我指出有关该问题的任何有用信息吗?

Is the @helper directive no longer supported? Can someone point me to anything useful about the issue?

推荐答案

@helper指令自beta 4开始被删除,因为它对其他Razor功能施加了太多限制:

The @helper directive was removed since beta 4 because it imposed too many restrictions on other Razor features: https://github.com/aspnet/Razor/issues/281.

修改
需要明确的是:基于GitHub问题的讨论,Microsoft计划不带回@helper指令或将其替换为ASP.NET Core.

Edit
To be clear: based on the discussion in the GitHub issue(s) Microsoft is not planning to bring the @helper directive back or replace it in ASP.NET Core.

这篇关于@helper指令在ASP.NET5 MVC6 beta4中不再可用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆