Not able to install bootstrap 4 (beta) nuget package to .Net MVC (.Net version 4.6.2)

前端 未结 9 1841
Happy的楠姐
Happy的楠姐 2021-02-19 07:58

I am not able to install bootstrap 4(beta) to my MVC project. To be precise popper.js nuget dependency is failing to install. Please let me know any possible way to do it(bower

9条回答
  •  忘了有多久
    2021-02-19 08:36

    I managed to get around this problem by downloading the latest (1.12.3 at the time of writing) popper.js nuget package before updating to bootstrap 4.0.

    Then in the bundles.config I added the popper js like this

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

    The umd version is the only one that worked for me the others gave an console error of

    Unrecognised Token Export

    Just make sure to include the popper js file before the bootstrap one.

    @Scripts.Render("~/bundles/popper")
    @Scripts.Render("~/bundles/bootstrap")
    

    I also noticed that this then broke the majority of the auto produced template as it's based on previous versions of bootstrap. The navbar almost completely vanishes. I managed to fix mine by replacing it with the following, but this doesn't include any items in the mobile menu.

    
    

    I know this question has a few good answers but this was the full solution that worked for me so I thought I'd share it in the hope that it spares someone a bit of time in the future.

提交回复
热议问题