ASP.NET Core 1.0 – Enable Minification

To enable minification, ensure the following:
1. Config.asax, register the BundlesConfig
protected void Application_Start()


2. BundleConfig.cs, include the scripts and enable optimizations
public static void RegisterBundles(BundleCollection bundles)

  bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
BundleTable.EnableOptimizations = true;

3. main.html, register the scripts

@section scripts {

4. In addition the minification process changes $scope and $q into random variables. Since this does nto tell angular what to inject, the solution is to declare your dependencies wrapped in []:

       .controller("MyCtrl", ["$scope", "$q", function($scope, $q) {
  // your code


This is just the steps you need to enable minification.


About João Sousa
Senior Software Engineer in .Net (Microsoft Certified MTCS and MCPD). .NET Microsoft MVP 2015

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: