C# – How to reference version 1.1.0.0 of System.Web.Optimization assembly

asp.net-mvccnetsystem.web.optimization

I am currently trying to use a file upload called the Jquery-File-Upload by BlueImp in my MVC 4 application via nugget. This file upload depends on System.Web.Optimization namespace to work.

My application keeps throwing this error:

Error 9 Assembly 'Backload, Version=1.9.3.0, Culture=neutral,
PublicKeyToken=02eaf42ab375d363' uses 'System.Web.Optimization,
Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
which has a higher version than referenced assembly
'System.Web.Optimization, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'

I tried adjusting the web.config thus

<dependentAssembly>
    <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>

and I still keep getting the same message.

I have googled and found links asking to install Microsoft.AspNet.Web.Optimization via nugget, which I did and yet no problem solved.

Please how do I add the version 1.1.0.0 of System.Web.Optimization.dll.

Best Answer

This is, because Backload internally references Microsoft.AspNet.Web.Optimization version 1.1.0. In a new MVC project you typically reference the older 1.0.0 version. You only need to update to the new one:

Right click references in your project, select Manage NuGet packages and in the upcoming dialog select Updates on the left pane. Then, in the middle pane, look for "Microsoft ASP.NET Web Optimization Framework" version 1.1.0

NuGet: http://www.nuget.org/packages/Microsoft.AspNet.Web.Optimization/

Described here: http://docs.nuget.org/docs/start-here/managing-nuget-packages-using-the-dialog