ASP.NET MVC 捆绑错误 Bootstrap 版本
ASP.NET MVC Bundling wrong Bootstrap version
我有一个问题,生产中的 MVC4 中的捆绑以某种方式捆绑了我的项目中不再有的 Bootstrap 的旧版本。
我更新了 Bootstrap 的版本,因为我想在我的项目中使用一些旧版本不支持的 Glyphicons。
运行 在本地调试或发布模式下,所有 Glyphicons 都按预期显示,但一旦部署到生产环境(使用 msbuild 部署到 Azure Web App),较新的 Glyphicons 就会丢失,并且缩小的+bundled css 文件缺少对较新 Gyphicons 的引用 - 它本质上是 bootstrap.css
的旧版本
这是我的 RegisterBundles 方法:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = false;
// Clear out the list and add back the ones we want to ignore.
// Don't add back .debug.js.
bundles.IgnoreList.Clear();
bundles.IgnoreList.Ignore("*-vsdoc.js");
bundles.IgnoreList.Ignore("*intellisense.js");
bundles.Add(new StyleBundle("~/style/global").Include(
"~/Content/css/lib/bootstrap.css",
"~/Content/css/global.css"));
}
那么我正在使用...
@Styles.Render("~/style/global")
包括样式。
使用ResetAll()
方法清除和重置。更多信息 here.
我有一个类似的问题,我的 ASP.NET MVC 5
应用程序仍在使用旧版本的 bootstrap.css (3.0)
即使我从项目中删除了旧的 bootstrap.css 文件,并安装了 Bootstrap 3.3.7
NuGet包。当我 运行 应用程序并从浏览器执行 "View Page Source" 时,然后单击 "/Content/bootstrap.css" rel="stylesheet" link,它 STILL 显示旧的 bootstrap.css 文件内容。
我困惑了一个多小时,直到我意识到 css 页面被缓存了。 我想通了,因为当我点击 "/Content/bootstrap.css" rel="stylesheet" link 调出 bootstrap.css
然后刷新页面,它改变了到我的 3.3.7 版本。
无论如何,我决定 post 这个响应,因为它可能会帮助其他人理解问题可能是由缓存引起的。
我有一个问题,生产中的 MVC4 中的捆绑以某种方式捆绑了我的项目中不再有的 Bootstrap 的旧版本。
我更新了 Bootstrap 的版本,因为我想在我的项目中使用一些旧版本不支持的 Glyphicons。
运行 在本地调试或发布模式下,所有 Glyphicons 都按预期显示,但一旦部署到生产环境(使用 msbuild 部署到 Azure Web App),较新的 Glyphicons 就会丢失,并且缩小的+bundled css 文件缺少对较新 Gyphicons 的引用 - 它本质上是 bootstrap.css
的旧版本这是我的 RegisterBundles 方法:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = false;
// Clear out the list and add back the ones we want to ignore.
// Don't add back .debug.js.
bundles.IgnoreList.Clear();
bundles.IgnoreList.Ignore("*-vsdoc.js");
bundles.IgnoreList.Ignore("*intellisense.js");
bundles.Add(new StyleBundle("~/style/global").Include(
"~/Content/css/lib/bootstrap.css",
"~/Content/css/global.css"));
}
那么我正在使用...
@Styles.Render("~/style/global")
包括样式。
使用ResetAll()
方法清除和重置。更多信息 here.
我有一个类似的问题,我的 ASP.NET MVC 5
应用程序仍在使用旧版本的 bootstrap.css (3.0)
即使我从项目中删除了旧的 bootstrap.css 文件,并安装了 Bootstrap 3.3.7
NuGet包。当我 运行 应用程序并从浏览器执行 "View Page Source" 时,然后单击 "/Content/bootstrap.css" rel="stylesheet" link,它 STILL 显示旧的 bootstrap.css 文件内容。
我困惑了一个多小时,直到我意识到 css 页面被缓存了。 我想通了,因为当我点击 "/Content/bootstrap.css" rel="stylesheet" link 调出 bootstrap.css
然后刷新页面,它改变了到我的 3.3.7 版本。
无论如何,我决定 post 这个响应,因为它可能会帮助其他人理解问题可能是由缓存引起的。