How is {version} value being populated in BundleConfig file?
Asked Answered
P

3

15

I recently added jquery.dataTables nuget package to my project and I wanted to bundle the necessary files inside the BundleConfig. Since this package is installed inside a "DataTables-1.9.4" folder within 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 handled in user code

When I modify the line to:

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

it works just fine.

So my question is how does the version get injected in the case of JQuery bundle? Is this defined someplace in the package itself and is there a way for me to fix this? I hate the idea of having to change my bundle config every time I update the dataTables nuget package...

Psychometrics answered 4/12, 2013 at 14:39 Comment(0)
P
9

Nevermind I found the answer here:

New .NET feature bundle and minification {version} wildcard doesn't work with directories?

Apparently folders are not supported by this feature...

Psychometrics answered 4/12, 2013 at 20:10 Comment(0)
W
11

{version} just tells the bundler to look for a string in the form of N[.N[.N]] and pick the file with the highest numbers.

Wreckful answered 4/12, 2013 at 16:16 Comment(1)
I'm aware of that but look where? Does it work on folders or files only? Can you explain the full logic behind it? as you can see in my case it failed because it was used on a folder...Psychometrics
P
9

Nevermind I found the answer here:

New .NET feature bundle and minification {version} wildcard doesn't work with directories?

Apparently folders are not supported by this feature...

Psychometrics answered 4/12, 2013 at 20:10 Comment(0)
F
5

{version} is not support to the directories.It is only support to the part of the file name.

Fielder answered 10/9, 2014 at 5:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.