Compile-time bundle generation using MSBuild

By default, Cassette bundle's are generated at runtime and cached. For a large application, especially one using CoffeeScript or Sass, the bundle processing can noticeably slow down start-up time.

To avoid impacting production application start-up time, Cassette provides an MSBuild task that creates the processed bundle cache at compile-time. Then at runtime, this pre-built cache is used, drastically reducing the amount of CPU and file I/O required.


Install the Cassette.MSBuild nuget package.

This package adds a Cassette.targets file to your web application and modifies the project file to import it. Also, the <cassette> configuration section in Web.config if modified to tell Cassette where to find the compile-time generated cache files.

After successful build, the CreateBundles MSBuild task is run. By default, the bundle cache is saved in the cassette-cache directory in the root of the web application.


Please note that when Cassette is in debug-mode, the compile-time cache is not used. So when testing the compile-time created bundles, be sure to set debug=false in Web.config.