Skip to content

How to upgrade applications to version 2.X

Andrey Taritsyn edited this page Oct 17, 2018 · 8 revisions

In order to install the packages of WebMarkupMin version 2.X you need to upgrade the NuGet Package Manager to version 2.8.6 or higher.

If you develop ASP.NET Core 1.X application, then you need to start from scratch. About how to do this read in “ASP.NET Extensions” and “ASP.NET Core 1.X” sections of the documentation.

The main breaking change of WebMarkupMin version 2.X was refusal from the usage Web.config and App.config files for configuring of the core and other modules. Now during configuration instead of the declarative approach (using the configuration file) is used in the imperative approach (using the program code).

Therefore, when upgrading WebMarkupMin to version 2.X always need to do 2 things:

  1. Uninstall a WebMarkupMin.ConfigurationIntelliSense package, because it has become useless.
  2. After uninstall of obsolete packages and upgrade of old packages, you must remove the webMarkupMin configuration section group and its declaration from the Web.config and App.config files:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        …
        <sectionGroup name="webMarkupMin">
            …
        </sectionGroup>
        …
    </configSections>
    …
    <webMarkupMin xmlns="http://tempuri.org/WebMarkupMin.Configuration.xsd">
        …
    </webMarkupMin>
    …
</configuration>

Next, consider the upgrade procedure for each package:

Core

After upgrading of the WebMarkupMin.Core package you need in application code to replace all usings of WebMarkupMin.Core.Minifiers and WebMarkupMin.Core.Settings namespaces by WebMarkupMin.Core namespace.

External JS and CSS minifiers

MS Ajax

After upgrading of the WebMarkupMin.MsAjax package you need in application code to replace all usings of WebMarkupMin.MsAjax.Minifiers and WebMarkupMin.MsAjax.Settings namespaces by WebMarkupMin.MsAjax namespace.

YUI

After upgrading of the WebMarkupMin.Yui package you need in application code to replace all usings of WebMarkupMin.Yui.Minifiers and WebMarkupMin.Yui.Settings namespaces by WebMarkupMin.Yui namespace.

ASP.NET 4.X Extensions

Major innovations in WebMarkupMin ASP.NET extensions version 2.X:

  1. Transition to an imperative approach for configuring of extensions.
  2. Now you can associate media types (content types) with specific markup minifier.
  3. Have the opportunity to include/exclude a site pages from processing by corresponding markup minifier.

More details about these changes can be read in “ASP.NET Extensions” and “ASP.NET 4.X Extensions” sections of the documentation.

HTTP modules

To upgrade an application, that uses HTTP modules from the WebMarkupMin.Web package you need to perform the following steps:

  1. Uninstall a WebMarkupMin.Web package.
  2. Install a WebMarkupMin.AspNet4.HttpModules package.
  3. Upgrade a remaining old WebMarkupMin packages to version 2.X.
  4. In Web.config file must be replaced: WebMarkupMin.Web.HttpModules namespace by WebMarkupMin.AspNet4.HttpModules, WebMarkupMin.Web assembly name by WebMarkupMin.AspNet4.HttpModules and CompressionModule class name by HttpCompressionModule.

More information about the WebMarkupMin.AspNet4.HttpModules package you can read in “ASP.NET 4.X HTTP modules” section of the documentation.

MVC

To upgrade an ASP.NET MVC application, that uses the action filters from the WebMarkupMin.Mvc package you need to perform the following steps:

  1. Uninstall a WebMarkupMin.Mvc and WebMarkupMin.Web packages.
  2. Install a WebMarkupMin.AspNet4.Mvc package.
  3. Upgrade a remaining old WebMarkupMin packages to version 2.X.
  4. In application code need to replace all usings of WebMarkupMin.Mvc.ActionFilters namespace to WebMarkupMin.AspNet4.Mvc.

More information about the WebMarkupMin.AspNet4.Mvc package you can read in “ASP.NET 4.X MVC” section of the documentation.

Web Forms

To upgrade an ASP.NET Web Forms application, that uses the Web Forms page and master page classes from the WebMarkupMin.WebForms package you need to perform the following steps:

  1. Uninstall a WebMarkupMin.WebForms and WebMarkupMin.Web packages.
  2. Install a WebMarkupMin.AspNet4.WebForms package.
  3. Upgrade a remaining old WebMarkupMin packages to version 2.X.
  4. In application code need to replace all usings of WebMarkupMin.WebForms.Pages and WebMarkupMin.WebForms.MasterPages namespaces by WebMarkupMin.AspNet4.WebForms namespace.

More information about the WebMarkupMin.AspNet4.WebForms package you can read in “ASP.NET 4.X Web Forms” section of the documentation.