Taghelpers与Bootstrap 4

时间:2018-02-21 20:19:33

标签: c# twitter-bootstrap asp.net-core asp.net-core-tag-helpers

我试图将Bootstrap 4集成到我的应用程序中。在我的_Layout.cshtml文件中,我有以下内容:

<link asp-href-include="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-href-exclude="**/*-reboot*,**/*-grid*" rel="stylesheet" />

我的凉亭配置文件:

{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "bootstrap": "~4.0.0"
  }
}

我的_ViewImports.cshtml(在/ Views文件夹中,而不是/ Views / Shared文件夹中)

@addTaghelper *, Microsoft.AspNetCore.Mvc.Taghelpers

我的_Layout.cshtml文件中有_ViewStart.cshtml

使用asp-href-includeasp-href-exclude标记时,引导链接似乎无效。不应用引导程序布局。当我使用基本的

<link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />

在我的_Layout.cshtml中,应用了Bootstrap但不是我想要的布局。如何集成标记器以获得所需的设计?

1 个答案:

答案 0 :(得分:2)

愚蠢的错误,大写TagHelpers中的“H”固定它

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers