System.Web.Extensions has already been imported

Taking an old site from DNN6.0.2 to 7.0.2 I encountered an error. Unlike recent errors relating to the framework version, the error given was:

CS1703: An assembly with the same identity 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' has already been imported. Try removing one of the duplicate references.

The issue was resolved by removing the file system.web.extensions.dll.

This old file provided the support for ajax. It is handled differently in .netframework 4.

In the file web.config there were references to this file. These were commented out and subsequently removed. An example is:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="managedHandler" />