Changing the Ordering for Bundles in ASP.NET

I've seen a couple of recent questions on Stack Overflow lately referencing Steve's Coding Blog article Changing the ordering for single bundles in Asp.Net 4... followed by questions on why it didn't work.

Well, it DID work, but in a recent update to the Microsoft ASP.NET Web Optimization Framework, the IBundleBuilder interface has changed (anything after v1.0.0). So if you follow the example in the blog, you'll get this error:

'MvcApplication2.PassthruBundleOrderer' does not implement interface member 'System.Web.Optimization.IBundleOrderer.OrderFiles(System.Web.Optimization.BundleContext, System.Collections.Generic.IEnumerable<System.Web.Optimization.BundleFile>)'

Luckily, it's an easy fix. Simply, you change the FileInfo to BundleFile. So this:

public class PassthruBundleOrderer : IBundleOrderer
{
    public virtual IEnumerable OrderFiles(BundleContext context, IEnumerable files)
    {
        return files;
    }
}

becomes this:

public class PassthruBundleOrderer : IBundleOrderer
{
    public virtual IEnumerable OrderFiles(BundleContext context, IEnumerable files)
    {
        return files;
    }
}

Yeah. That's it. Happy coding!

Wait! If you use bundling, you should read my recent article Changing User-Agent to Eureka/1 Changes Output in ASP.NET Bundling and Minification.