# c# – {version} wildcard in MVC4 Bundle

## The Question :

157 people think this question is useful

In MVC 4 we have bundles. While defining the bundles we can use wildcards like * for all files in a folder.

In the example below what does -{version} mean?

public static void RegisterBundles(BundleCollection bundles)
{
"~/Scripts/jquery-{version}.js"));
}



179 people think this answer is useful

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 jquery.

• {version} only works for the last part of the path–basically the file name–not a directory.
• multiple version of jquery in the same folder will all get caught up.

~/Scripts/jquery-{version}.js is included in it. Here bundling system is smart enough to reference the highest version of jquery file when we specified {version} selector in the path. Also, this bundling system is smart enough to pick the minified version of the file, if available at the defined path.