El paquete personalizado en MVC 4 no se procesa

Estoy trabajando en ASP.NET MVC 4 application. I want to make my own bundle containing .js files which I will use for validation but for some reason it's not working. Just to mention - if I render all my scripts in a given view everything is working fine like:

//..few more files

but I don't want to include all those scripts each time so I decided to make my own bundle. The steps I made are:

  • In BundleConfig.cs Tengo esto :

public static void RegisterBundles(BundleCollection bundles)


//The defaults bundles

bundles.Add(new ScriptBundle("~/bundles/customval").Include(



Entonces reviso mi Global.asax where I have this :


and then in my view I just try :


y FireBug is saying that no JavaScript is load for this page.

I use custom _Layout page and I wonder if I have to add something there. I added:

@RenderSection("scripts", required: false)

en mi _Layout but it doesn't seem to solve something. So what am I missing to make my bundles working?

preguntado el 05 de diciembre de 13 a las 10:12

2 Respuestas

You're probably running in DEBUG mode. in this mode .min.js files are ignored (as they're only intended for Production use).

It would be best to include the non-minified (sometimes suffixes with .debug.js) versions, then on RELEASE mode the Optimization Framework will Bundle and Minify it for you automatically (unless you specify otherwise).

Respondido el 05 de diciembre de 13 a las 10:12

I have had to add:

BundleTable.EnableOptimizations = false;

at the end of the RegisterBundles method. In my old age :) I can't remember exactly what the issue was but it has to do with the .min files and debugging if memory serves me right.

The @RenderSection("scripts", required: false) is to allow you to have a special scripts section (optional in your case) defined in each view and have it rendered in the same place in every page that uses the _layout file.

Respondido el 05 de diciembre de 13 a las 10:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.