Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference version 1.1.0.0 of System.Web.Optimization assembly

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.

like image 379
Shittu Joseph Olugbenga Avatar asked Sep 24 '13 08:09

Shittu Joseph Olugbenga


2 Answers

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

like image 57
helgans Avatar answered Nov 15 '22 03:11

helgans


This was how i resolved this issue. First i followed the @helgans comment under his answer and still kept getting the reference to version 1.0.0 of system.web.optimization in the reference folder. I also deleted the dll from the bin folder of my website and reference version 1.1.0 from another project, yet the same problem persist.

In solving the problem, I discovered that the older version was being copied from the library folder in my application (well i do not know how). This makes the referenced version remain version 1.0.0, even if i referenced version 1.1.0 from another project or re-install the NuGet package again.

To solve this problem, i did the following:

  1. I deleted the dll from the Library folder.
  2. Removed the reference of the older version (thanks to @helgans)
  3. Removed the dll from the bin folder
  4. Unistall the package: Uninstall-Package Microsoft.AspNet.Web.Optimization -Force
  5. Re-install the package

The NuGet now adds reference to version 1.1.0

like image 37
Shittu Joseph Olugbenga Avatar answered Nov 15 '22 03:11

Shittu Joseph Olugbenga