ASP.NET Bundling – Bundle not updating after included file has changed (returns 304 not modified)

I just had the exact same problem. I have a folder with 2 CSS files: ~/Content/main.css ~/Content/main.min.css (pre-existing from my previous manual minification process) My bundling code is this: bundles.Add(new StyleBundle(“~/css/main”).Include(“~/content/main.css”)); No matter how much I changed my main.css the output was the same url with the same contents: <link href=”https://stackoverflow.com/css/main?v=6Xf_QaUMSlzHbXralZP7Msq1EiLTd7g1vId6Vcy8NJM1″ rel=”stylesheet”/> The only way … Read more

How to force BundleCollection to flush cached script bundles in MVC4

We hear your pain on documentation, unfortunately this feature is still changing quite fast, and generating documentation has some lag, and can be outdated almost immediately. Rick’s blog post is up to date, and I’ve tried to answer questions here as well to spread current info in the meantime. We are currently in the process … Read more

How can I specify an explicit ScriptBundle include order?

You could write a custom bundle orderer (IBundleOrderer) that will ensure bundles are included in the order you register them: public class AsIsBundleOrderer : IBundleOrderer { public virtual IEnumerable<FileInfo> OrderFiles(BundleContext context, IEnumerable<FileInfo> files) { return files; } } and then: public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { var bundle = new Bundle(“~/bundles/scripts/canvas”); … Read more

ASP.NET MVC framework 4.5 CSS bundle does not work on the hosting

My guess is that the path Content/css exists on disk in your app. In this case IIS would be handling the request, not MVC. Make sure that the virtual path for the bundle (the parameter of the StyleBundle constructor) doesn’t match a folder in the file system. From the comments: “A good convention to follow … Read more

{version} wildcard in MVC4 Bundle

The -{version} basically maps to a version regex, or to be precise: (\d+(?:\.\d+){1,3}). Using * tends to grab too much, for example if you bundle jquery*, that will include jquery-ui as well which might mess up the ordering. But using jquery-{version}.js would let you avoid having to update your bundle definition every time you upgrade … Read more

Why use @Scripts.Render(“~/bundles/jquery”)

Bundling is all about compressing several JavaScript or stylesheets files without any formatting (also referred as minified) into a single file for saving bandwith and number of requests to load a page. As example you could create your own bundle: bundles.Add(New ScriptBundle(“https://stackoverflow.com/questions/12192646/~/bundles/mybundle”).Include( “~/Resources/Core/Javascripts/jquery-1.7.1.min.js”, “~/Resources/Core/Javascripts/jquery-ui-1.8.16.min.js”, “~/Resources/Core/Javascripts/jquery.validate.min.js”, “~/Resources/Core/Javascripts/jquery.validate.unobtrusive.min.js”, “~/Resources/Core/Javascripts/jquery.unobtrusive-ajax.min.js”, “~/Resources/Core/Javascripts/jquery-ui-timepicker-addon.js”)) And render it like this: @Scripts.Render(“https://stackoverflow.com/questions/12192646/~/bundles/mybundle”) One … Read more

MVC4 StyleBundle not resolving images

According to this thread on MVC4 css bundling and image references, if you define your bundle as: bundles.Add(new StyleBundle(“~/Content/css/jquery-ui/bundle”) .Include(“~/Content/css/jquery-ui/*.css”)); Where you define the bundle on the same path as the source files that made up the bundle, the relative image paths will still work. The last part of the bundle path is really the … Read more

How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app

Update Version 1.1.x is available, read the release notes: https://www.nuget.org/packages/Microsoft.AspNet.Web.Optimization The Microsoft.Web.Optimization package is now obsolete. With ASP.NET (MVC) 4 and higher you should install the Microsoft ASP.NET Web Optimization Framework: Install the package from nuget: Install-Package Microsoft.AspNet.Web.Optimization Create and configure bundle(s) in App_Start\BundleConfig.cs: public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)