title: Could not load file or assembly 'WebGrease' one of its dependencies. The located assembly's manifest definition does not match the assembly reference
body: <p><strong>This issue has many solutions, please read all answers below, they might help you solve your problem too. If you find a new way to solve this, please document in your answer</strong> </p>
  
  <p>I am trying to add System.Web.Optimization to my ASP.NET Web Forms solution.
  I added Microsoft ASP.NET Web Optimization Framework through NuGet Packages. It added Microsoft.Web.Infrastracture and WebGrease (1.5.2) to the references.</p>
  
  <p>However, when I run </p>
  
  <pre><code>&lt;%= System.Web.Optimization.Scripts.Render("~/bundles/js")%&gt;
  </code></pre>
  
  <p>I get runtime error</p>
  
  <pre><code>Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  </code></pre>
  
  <p>I have tried adding assemblyBinding to the Web.Config</p>
  
  <pre><code>&lt;runtime&gt;
    &lt;legacyUnhandledExceptionPolicy enabled="1"/&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.5.1.25624" newVersion="1.5.2.14234"/&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
  &lt;/runtime&gt;
  </code></pre>
  
  <p>But without any luck.</p>
  
  <p>I noticed that my WebSite's Web config contains this line</p>
  
  <pre><code> &lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt;
  </code></pre>
  
  <p>If I replace it with </p>
  
  <pre><code> &lt;configuration&gt;
  </code></pre>
  
  <p>Then everything works and I don't get the runtime error. Unfortunately, I need the xmlns. Other components of my project depend on it.</p>
  
  <p>Why would Optimization try to load an older version when schema is pointing to v2.0? Is there a way to force it to load the latest or the only available WebGrease.dll?</p>
  
  <p>What else can I try without changing the</p>
  
  <pre><code> &lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt; ?
  </code></pre>
  
  <p>Thank you for any help you can provide!</p>
  
  <p>Edit:
  1) Attaching FusionLog Result. Maybe it will be helpful</p>
  
  <pre><code>=== Pre-bind state information ===
  LOG: User = [USER]
  LOG: DisplayName = WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35
  (Fully-specified)
  LOG: Appbase = file:///C:/Projects/PROJECT_NAME/trunk/www.PROJECT_NAME.com/
  LOG: Initial PrivatePath = C:\Projects\PROJECT_NAME\trunk\www.PROJECT_NAME.com\bin
  Calling assembly : System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
  ===
  LOG: This bind starts in default load context.
  LOG: Using application configuration file: C:\Projects\PROJECT_NAME\trunk\www.PROJECT_NAME.com\web.config
  LOG: Using host configuration file: 
  LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
  LOG: Post-policy reference: WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35
  </code></pre>
  
  <p>2) Confirmed, The issue is in </p>
  
  <pre><code>&lt;configuration  xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt;
  </code></pre>
  
  <p>However, I don't understand why </p>