ASP.NET MVC 3 site trying to load MVC version 2 dll??

Discussion in 'General troubleshooting' started by leftend, Oct 24, 2011.

  1. I'm trying to get my site to work, and am using ASP.NET MVC 3. I've already changed the site's version to 4.0 in the control panel, and have bin deployed all of the required dll's for MVC to work. However, I keep getting this error message:

    Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, 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)

    What's strange, is that the error calls out version 2.0.0.0, but my web.config explicitly specifies version 3.0.0.0 for the System.Web.Mvc assembly:

    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

    I've also double-checked that the dll I'm uploading is version 3.0.0.0

    Here's the site if you want to see the error first hand:
    http://sdbwplanner.com

    Anybody have any ideas?

    Thanks in advance.
     
  2. Solved

    Ha! Figures I would find the answer after posting the question. For those interested, here you go:

    I DID already have the "bindingRedirect" included in my web config, as follows:

    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
    </runtime>

    However, after finding an article by Scott Hanselman here: http://www.hanselman.com/blog/Integ...stingUpgradedASPNET4WebFormsApplications.aspx

    I noticed that he had one extra line (bolded below), so I added that and everything started working.

    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
    </runtime>

    Hope that helps.
     
  3. Thanks for posting the follow-up, I'm sure it will help someone.
     

Share This Page