原來專案的是bootstrap3的版本,有一些畫面想升級到bootstrap5
在載入js的 @Scripts.Render("~/bundles/bootstrap5") 出現 「並未將物件參考設定為物件的執行個體」。
解法 把 "new ScriptBundle" 改為 "new Bundle"
// 原來 bootstrap3 js
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.min.js","~/Scripts/respond.min.js"));
// bootstrap5.1.3 js
bundles.Add(new Bundle("~/bundles/bootstrap5").Include("~/Scripts/bootstrap-5.1.3/bootstrap.bundle.min.js"));
文章標籤
全站熱搜