VS 2015中禁用了标签助手 [英] Tag Helpers disabled in VS 2015

查看:80
本文介绍了VS 2015中禁用了标签助手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在项目中启用标签助手.

I am having trouble getting Tag Helpers enabled in my project.

以下是项目设置的摘要:

Here is a summary of the project setup:

  • VS 2015 RC社区版.
  • Project.json参考:Microsoft.AspNet.Mvc": "6.0.0-beta4
  • _GlobalImport.chtml具有@addTagHelper"*,Microsoft.AspNet.Mvc.TagHelpers"
  • VS 2015 RC Community Edition.
  • Project.json reference: Microsoft.AspNet.Mvc": "6.0.0-beta4
  • _GlobalImport.chtml has @addTagHelper"*,Microsoft.AspNet.Mvc.TagHelpers"

没有构建错误或警告.

必须丢失一些东西,但是我不知道什么.

Must missing something, but I don't know what.

更新:

似乎我是那里的一部分.我在_ViewStart.chtml.中添加了@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers",Razor现在将诸如<a asp-controller="Home" asp-action="Summary" title="Manage">TEST</a>之类的事情作为具有适当href属性的链接进行处理.但是intellisense不能正常工作.

Seems I am part of the way there. I added @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" to the _ViewStart.chtml. Razor is now processing things like <a asp-controller="Home" asp-action="Summary" title="Manage">TEST</a> as a link with a proper href attribute. However intellisense on not working.

推荐答案

1)在您的project.json dependencies中,确保您拥有以下3个内容:

1) In your project.json dependencies, make sure you have these 3:

"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},

2)确保在project.json tools中,您拥有:

2) In your project.json tools, make sure you have:

"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"

3)在您的Views\_ViewImports.cshtml中,确保您具有:

3) In Your Views\_ViewImports.cshtml, make sure you have:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

然后rebuild该项目,您应该一切顺利. (如果不尝试重新启动VS.)

Then rebuild the project and you should be good to go. (If not try restarting VS.)

这篇关于VS 2015中禁用了标签助手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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