如何在Linux中的MVC中手动安装引导程序?

时间:2018-10-18 18:20:41

标签: asp.net-mvc linux asp.net-core bootstrap-4

我目前正在Linux中使用Visual Studio Code构建Web应用程序。我正在尝试手动对其应用引导程序。我下载了Bootstrap 4.1.3,将其解压缩并将其放在文件夹wwwroot / lib / bootstrap中。我尝试添加                       将以下代码添加到/View/Shared/_Layout.cshtml文件,但无法正常工作。 我四处搜寻,每个人都在谈论Bower停产。我不知道是否需要Bower这样的工具,但如果可能的话,我想手动设置所有内容,以便学习并保留在Linux OS上。任何有关如何在Linux中进行设置的帮助将不胜感激。 更新:_Layout.cshtml代码。

<!DOCTYPE html>
<html>
    <head>
        <environment include="Development">
        <link rel="stylesheet" type="text/css" href="~/../../../wwwroot/lib/bootstrap/css/bootstrap.css">
        </environment>

    </head>
    <body>
        <nav class="navbar navbar-expand-md navbar-dark bg-dark">
                    <a class="navbar-brand" href="#">Concentric</a>
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                      <span class="navbar-toggler-icon"></span>
                    </button>

                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                      <ul class="navbar-nav mr-auto">
                        <li class="nav-item active">
                          <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#">Link</a>
                        </li>
                        <li class="nav-item dropdown">
                          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Dropdown
                          </a>
                          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="#">Action</a>
                            <a class="dropdown-item" href="#">Another action</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="#">Something else here</a>
                          </div>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link Disabled" href="#">Disabled</a>
                        </li>
                      </ul>
                      <form class="form-inline my-2 my-lg-0">
                        <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
                        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
                      </form>
                    </div>
                  </nav>

        <div>
            @RenderBody()
        </div>


        <footer>
            @RenderSection("footer", false)
        </footer>
    </body>
</html>

1 个答案:

答案 0 :(得分:0)

您可以考虑将公共BootstrapCDN用于教育目的。请检查:https://getbootstrap.com/docs/4.0/getting-started/introduction/

此外,我可以建议您检查入门模板,以便更好地组织项目并快速获取知识。您无需再次发明滚轮。我可以建议的一些入门模板是

  

https://github.com/aspnet/MusicStore/tree/master/samples/MusicStore   https://github.com/DevExpress/bootstrap-aspnetcore-starter
  https://github.com/MarkPieszak/aspnetcore-angular2-universal