Frage

After installing the SignalR NuGet package:

Install-Package Microsoft.AspNet.SignalR -pre 

I get the following files:

jquery.signalR-1.0.0-rc2.js
jquery.signalR-1.0.0-rc2.min.js

I register the bundle:

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

In my view I call:

@Scripts.Render("~/bundles/jquery.signalR")

It all works during development, but once I enable:

BundleTable.EnableOptimizations = true;

The bundle fails to render the script.

I've also tried:

bundles.Add(new ScriptBundle("~/bundles/jquery.signalR").Include(
            "~/Scripts/jquery.signalR-{version}-rc2.js"))

which is a bit useless, since the whole point of using {version} is to be ready for future releases, and the next release is getting rid of the "-rc2" bit.

How can I effectively use wild card matching to my advantage to match the script:

jquery.signalR-1.0.0-rc2.js

in development, and

jquery.signalR-1.0.0-rc2.min.js

in production, while at the same time being prepared for a future update of SignalR?

War es hilfreich?

Lösung

The {version} moniker in bundling does not work for pre-release scripts. To work with pre-release scripts you can use the following registration

bundles.Add(new ScriptBundle("~/bundles/jquery.signalR").Include(
        "~/Scripts/jquery.signalR*"));
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top