Css .net mvc默认应用程序,导航菜单不是水平的

Css .net mvc默认应用程序,导航菜单不是水平的,css,asp.net-mvc,bootstrap-4,navbar,Css,Asp.net Mvc,Bootstrap 4,Navbar,使用VS2017,我创建了一个新的MVC web项目。 当我运行默认应用程序时,导航菜单栏显示正常 然而,当我升级Nuget软件包(仅从3.3.7升级到4.1.3和Popper 1.14)并运行默认应用程序时。中提琴,通常水平排列的菜单项都是隐藏的。当我单击“应用程序名称”左侧的小图标时,菜单显示为下拉菜单(见图) 同样,我除了升级Nuget软件包之外什么也没做。所以bootstrap和其他一些项目得到了更新 我无法想象我是唯一一个看到这一点的人,但我找不到其他例子/问题。我检查了内容文件夹B

使用VS2017,我创建了一个新的MVC web项目。 当我运行默认应用程序时,导航菜单栏显示正常

然而,当我升级Nuget软件包(仅从3.3.7升级到4.1.3和Popper 1.14)并运行默认应用程序时。中提琴,通常水平排列的菜单项都是隐藏的。当我单击“应用程序名称”左侧的小图标时,菜单显示为下拉菜单(见图)

同样,我除了升级Nuget软件包之外什么也没做。所以bootstrap和其他一些项目得到了更新

我无法想象我是唯一一个看到这一点的人,但我找不到其他例子/问题。我检查了内容文件夹BundleConfig.cs、_Layout.cshtml,它们看起来都很正常

我检查了F12,没有断开的样式表链接等

还有人看到这个吗

这是来自_Layout.cshtml的菜单代码

<div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                @*@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })*@
                <a class="navbar-brand" href="#">App name</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    <li>@Html.ActionLink("About", "About", "Home")</li>
                    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                </ul>
                @Html.Partial("_LoginPartial")
            </div>
        </div>
    </div>

bootstrap 4中更改了很多类,因此您使用的类可能不再有效

是引导程序4中导航栏的工作示例


检查引导4导航栏文档。

引导主要版本是否更改?你检查过文档中是否有破坏性的更改吗?bootstrap 4中更改了很多类,因此你使用的类可能不再有效。下面是一个工作示例:这个问题是从bootstrap3.3.7升级到bootstrap4.0.0的典型问题。您需要稍微重新构造代码以适应新版本。谢谢各位。现在一切都有意义了。引导程序3.3.7至4.1.3完全重写了navbar类。所以MVC导航菜单(稍旧的版本)完全崩溃了@agDev-w3schools链接非常有用。
public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
        }