How is the {version} value populated in the BundleConfig file?

I recently added the jquery.dataTables nuget package for my project, and I wanted to link the necessary files inside the BundleConfig. Since this package is installed inside the "DataTables-1.9.4" folder in the Scripts folder, I added the following line to my BundlesConfig:

bundles.Add(new ScriptBundle("~/bundles/dataTables").Include( "~/Scripts/DataTables-{version}/media/js/jquery.dataTables.js")); 

However, I got the following error:

An exception of type "System.ArgumentException" occurred in System.Web.Optimization.dll, but was not processed in the user code

When I change the line to:

 bundles.Add(new ScriptBundle("~/bundles/dataTables").Include( "~/Scripts/DataTables-1.9.4/media/js/jquery.dataTables.js")); 

It works great.

So my question is, how is the version injected in the case of the jQuery package? Is it defined somewhere in the package itself and is there a way to fix this? I hate the idea of ​​changing the package configuration every time I update the nutet dataTables package ...

+7
asp.net-mvc scriptbundle
source share
3 answers

Nevermind I found the answer here:

New .NET feature set and minification {version} wildcards not working with directories

Apparently, folders are not supported by this function ...

+6
source share

{version} simply tells the binder that it is looking for a string in the form N[.N[.N]] and selects the file with the highest numbers.

+7
source share

{version} does not support directories. This is only support for the file name part.

+3
source share

All Articles