在Visual Studio中启用TagHelper Intellisense支持

时间:2016-05-19 04:46:34

标签: c# asp.net-mvc asp.net-core

如何在Visual Studio 2015中的空白ASP.NET Core RC2应用程序中启用具有Intellisense支持的Tag Helpers,因为我将在RC1中执行此操作,这是我所熟知的。

1 个答案:

答案 0 :(得分:3)

要在ASP.NET Core RC2项目中添加Tag Helpers,请在Views文件夹的根目录中添加_ViewImports文件并添加

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

在project.json文件中,添加以下依赖项和工具:

{
"dependencies": {
"Microsoft.NETCore.App": {
  "version": "1.0.0-rc2-3002702",
  "type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview1-final",
  "type": "build"
}
 },

 "tools": {
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview1-final",
  "imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
  "version": "1.0.0-preview1-final",
  "imports": "portable-net45+win8+dnxcore50"
}
},
}

您可能需要重新启动VS才能获得智能感知。