title: Error CS1705: Assembly uses 'System.Web.Mvc, Version=5.2.3.0' which has a higher version than referenced assembly
body: <p>I recently updated my project MVC 5.2.3 (using Nuget). Everything builds fine locally, but when I deploy to AppHarbor, I get the following precompilation error:</p>
  
  <p><strong>An error occurred while compiling the views</strong></p>
  
  <p>The log shows:</p>
  
  <blockquote>
    <p>Microsoft (R) ASP.NET Compilation Tool version 4.6.1590.0 Utility to
    precompile an ASP.NET application Copyright (C) Microsoft Corporation.
    All rights reserved.</p>
    
    <p>(0): error CS1705: Assembly 'PickemApp, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc,
    Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    which has a higher version than referenced assembly 'System.Web.Mvc,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'</p>
    
    <p>[HttpCompileException]: (0): error CS1705: Assembly 'PickemApp,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses
    'System.Web.Mvc, Version=5.2.3.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35' which has a higher version than
    referenced assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35'    at
    System.Web.Compilation.AssemblyBuilder.Compile()    at
    System.Web.Compilation.BuildProvidersCompiler.PerformBuild()    at
    System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath
    virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet
    excludedSubdirectories, Boolean isDirectoryAllowed)    at
    System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath
    virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet
    excludedSubdirectories)    at
    System.Web.Compilation.BuildManager.CompileCodeDirectories()    at
    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()<br>
    at
    System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath
    startingVirtualDir, IEnumerable<code>1 excludedVirtualPaths)    at
    System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath
    startingVirtualDir, IEnumerable</code>1 excludedVirtualPaths)    at
    System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback
    callback, IEnumerable<code>1 excludedVirtualPaths)    at
    System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback
    callback, List</code>1 excludedVirtualPaths)    at
    System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback
    callback, List`1 excludedVirtualPaths)    at
    System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback
    callback, Boolean forceCleanBuild)    at
    System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback
    callback)    at System.Web.Compilation.Precompiler.Main(String[] args)</p>
    
    <p>Website precompilation failed with exit code 1. Precompilation can
    optionally be disabled in your AppHarbor application settings</p>
  </blockquote>
  
  <p>I have checked everywhere in my project and can't find a single reference to MVC 1 that would be causing this error. I'm fairly certain I've updated my references and web.config to properly use MVC 5.2.3, but the error persists. Here are my web.config files. I'm sure I missed something, but what? I've looked at all the related questions on this site and none of the suggestions worked for me.</p>
  
  <p><strong>web.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    --&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
  
          &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
          &lt;sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core"&gt;
              &lt;section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" /&gt;
              &lt;section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" /&gt;
              &lt;section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" /&gt;
              &lt;section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" /&gt;
          &lt;/sectionGroup&gt;
      &lt;/configSections&gt;
      &lt;connectionStrings&gt;
          &lt;add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=RCPickEm;Integrated Security=SSPI" providerName="System.Data.SqlClient" /&gt;
          &lt;!--&lt;add name="PickemDBContext" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\PickemDB2.mdf;Initial Catalog=PickemDB2;Integrated Security=True;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" /&gt;--&gt;
          &lt;add name="PickemDBContext" connectionString="Data Source=localhost;Initial Catalog=RCPickEm;Integrated Security=SSPI" providerName="System.Data.SqlClient" /&gt;
      &lt;/connectionStrings&gt;
      &lt;appSettings&gt;
          &lt;add key="currentYear" value="2016" /&gt;
          &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
          &lt;add key="webpages:Enabled" value="false" /&gt;
          &lt;add key="PreserveLoginUrl" value="true" /&gt;
          &lt;add key="ClientValidationEnabled" value="true" /&gt;
          &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
      &lt;/appSettings&gt;
      &lt;!--
      For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
  
      The following attributes can be set on the &lt;httpRuntime&gt; tag.
        &lt;system.Web&gt;
          &lt;httpRuntime targetFramework="4.5.1" /&gt;
        &lt;/system.Web&gt;
    --&gt;
      &lt;system.web&gt;
          &lt;compilation debug="true" targetFramework="4.5.1" /&gt;
          &lt;authentication mode="Forms"&gt;
              &lt;forms loginUrl="~/Account/Login" timeout="2880" /&gt;
          &lt;/authentication&gt;
          &lt;pages controlRenderingCompatibilityVersion="4.0"&gt;
              &lt;namespaces&gt;
                  &lt;add namespace="System.Web.Helpers" /&gt;
                  &lt;add namespace="System.Web.Mvc" /&gt;
                  &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
                  &lt;add namespace="System.Web.Mvc.Html" /&gt;
                  &lt;add namespace="System.Web.Optimization" /&gt;
                  &lt;add namespace="System.Web.Routing" /&gt;
                  &lt;add namespace="System.Web.WebPages" /&gt;
              &lt;/namespaces&gt;
          &lt;/pages&gt;
      &lt;/system.web&gt;
      &lt;system.webServer&gt;
          &lt;validation validateIntegratedModeConfiguration="false" /&gt;
          &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  
          &lt;handlers&gt;
              &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
              &lt;remove name="OPTIONSVerbHandler" /&gt;
              &lt;remove name="TRACEVerbHandler" /&gt;
              &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt;
          &lt;/handlers&gt;
      &lt;/system.webServer&gt;
      &lt;runtime&gt;
          &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /&gt;
              &lt;/dependentAssembly&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /&gt;
              &lt;/dependentAssembly&gt;
          &lt;/assemblyBinding&gt;
          &lt;!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). --&gt;
          &lt;legacyHMACWarning enabled="0" /&gt;
          &lt;!-- When targeting ASP.NET MVC 3, this assemblyBinding makes MVC 1 and 2 references relink
               to MVC 3 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it.
          &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
              &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
              &lt;/dependentAssembly&gt;
          &lt;/assemblyBinding&gt;
           --&gt;
      &lt;/runtime&gt;
      &lt;entityFramework&gt;
          &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
          &lt;providers&gt;
              &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
          &lt;/providers&gt;
      &lt;/entityFramework&gt;
      &lt;system.net&gt;
          &lt;defaultProxy enabled="true" /&gt;
          &lt;settings&gt;
              &lt;!-- This setting causes .NET to check certificate revocation lists (CRL) 
                   before trusting HTTPS certificates.  But this setting tends to not 
                   be allowed in shared hosting environments. --&gt;
              &lt;!--&lt;servicePointManager checkCertificateRevocationList="true"/&gt;--&gt;
          &lt;/settings&gt;
          &lt;mailSettings&gt;
              &lt;smtp&gt;
                  &lt;network host="localhost" port="25" defaultCredentials="true" /&gt;
              &lt;/smtp&gt;
          &lt;/mailSettings&gt;
      &lt;/system.net&gt;
      &lt;dotNetOpenAuth&gt;
          &lt;messaging&gt;
              &lt;untrustedWebRequest&gt;
                  &lt;whitelistHosts&gt;
                      &lt;!-- Uncomment to enable communication with localhost (should generally not activate in production!) --&gt;
                      &lt;!--&lt;add name="localhost" /&gt;--&gt;
                  &lt;/whitelistHosts&gt;
              &lt;/untrustedWebRequest&gt;
          &lt;/messaging&gt;
          &lt;!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --&gt;
          &lt;reporting enabled="true" /&gt;
          &lt;!-- This is an optional configuration section where aspects of dotnetopenauth can be customized. --&gt;
          &lt;!-- For a complete set of configuration options see http://www.dotnetopenauth.net/developers/code-snippets/configuration-options/ --&gt;
          &lt;openid&gt;
              &lt;relyingParty&gt;
                  &lt;security requireSsl="false"&gt;
                      &lt;!-- Uncomment the trustedProviders tag if your relying party should only accept positive assertions from a closed set of OpenID Providers. --&gt;
                      &lt;!--&lt;trustedProviders rejectAssertionsFromUntrustedProviders="true"&gt;
                          &lt;add endpoint="https://www.google.com/accounts/o8/ud" /&gt;
                      &lt;/trustedProviders&gt;--&gt;
                  &lt;/security&gt;
                  &lt;behaviors&gt;
                      &lt;!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
                           with OPs that use Attribute Exchange (in various formats). --&gt;
                      &lt;add type="DotNetOpenAuth.OpenId.RelyingParty.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth.OpenId.RelyingParty" /&gt;
                  &lt;/behaviors&gt;
              &lt;/relyingParty&gt;
          &lt;/openid&gt;
      &lt;/dotNetOpenAuth&gt;
      &lt;uri&gt;
          &lt;!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
               which is necessary for OpenID urls with unicode characters in the domain/host name.
               It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. --&gt;
          &lt;idn enabled="All" /&gt;
          &lt;iriParsing enabled="true" /&gt;
      &lt;/uri&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><strong>views/web.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
        &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
  
    &lt;system.web.webPages.razor&gt;
      &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
        &lt;namespaces&gt;
          &lt;add namespace="System.Web.Mvc" /&gt;
          &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
          &lt;add namespace="System.Web.Mvc.Html" /&gt;
          &lt;add namespace="System.Web.Optimization"/&gt;
          &lt;add namespace="System.Web.Routing" /&gt;
        &lt;/namespaces&gt;
      &lt;/pages&gt;
    &lt;/system.web.webPages.razor&gt;
  
    &lt;appSettings&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="currentYear" value="2016" /&gt;
    &lt;/appSettings&gt;
  
    &lt;system.web&gt;
      &lt;httpHandlers&gt;
        &lt;add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/&gt;
      &lt;/httpHandlers&gt;
  
      &lt;!--
          Enabling request validation in view pages would cause validation to occur
          after the input has already been processed by the controller. By default
          MVC performs request validation before a controller processes the input.
          To change this behavior apply the ValidateInputAttribute to a
          controller or action.
      --&gt;
      &lt;pages
          validateRequest="false"
          pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;controls&gt;
          &lt;add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /&gt;
        &lt;/controls&gt;
      &lt;/pages&gt;
      &lt;compilation&gt;
        &lt;assemblies&gt;
          &lt;add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
        &lt;/assemblies&gt;
      &lt;/compilation&gt;
    &lt;/system.web&gt;
  
    &lt;system.webServer&gt;
      &lt;validation validateIntegratedModeConfiguration="false" /&gt;
  
      &lt;handlers&gt;
        &lt;remove name="BlockViewHandler"/&gt;
        &lt;add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /&gt;
      &lt;/handlers&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>