locked
System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 RRS feed

  • Question

  • User-640622294 posted

    Hi , i have a problem when publishing website cry

    web.config :

    <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
    </dependentAssembly>

    Error :

    Severity Code Description Project File Line Suppression State
    Error Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Tarh-Online D:\Develop\ASP\Tarh-Online\Tarh-Online\SGEN

    Monday, March 11, 2019 4:28 PM

Answers

  • User-640622294 posted
    • System.Web.Mvc
    • System.Web.Routing
    • System.Web.Abstractions
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 13, 2019 2:17 PM

All replies

  • User-474980206 posted

    while your web.config, say to load version 5.2.7.0 no matter what the manifest says, do you have matching redirects for the dependences & is .net framework 4.5+ installed

    Monday, March 11, 2019 7:38 PM
  • User1520731567 posted

    Hi reza-2017,

    Please make a backup before making changes.

    I found a simplest solution,you could try to:

    1.Open NuGet Package Manager in Visual studio for your project

    2.Search for Microsoft.AspNet.Mvc

    3.When found, change action to Uninstall and Uninstall it

    4.Once done, install it again and try it now

    Or,you could refer to this article:

    A few things can cause this, when I have this issue I do these things:

    1.) In Visual Studio go to Tools => Extensions and Updates. If there is an update to NuGet update it then close and reopen the project. It may be that the packages have changed and if you don't have the latest version the packages won't get automatically updated like they should.

    2.) Delete your bin/obj directories. Cleaning the solution doesn't always completely clean and you may have an old assembly in one of these directories.

    3.) In the Web.Config look at the binding redirects in the runtime=>assemblyBinding section. The new version value should be the newer version.

    4.) Look at each of the assemblies in each of the projects and find the one that is using the wrong version. Remove the reference and re-add it.

    Best Regards.

    Yuki Tao

    Tuesday, March 12, 2019 2:44 AM
  • User-640622294 posted

    doesn't work !

    Tuesday, March 12, 2019 1:08 PM
  • User1520731567 posted

    Hi reza-2017,

    There are many reasons for this error.

    I can only suggest what you can do.

    Please refer to this link:

    https://stackoverflow.com/questions/267006/could-not-load-file-or-assembly-system-web-mvc

    Some people think one of solutions is that you could try to add references to these assemblies and set Copy Local to True:

    * Microsoft.Web.Infrastructure
    * System.Web.Razor
    * System.Web.WebPages.Deployment
    * System.Web.WebPages.Razor

    Hope my reply will helpful to you.

    Best Regards.

    Yuki Tao

    Wednesday, March 13, 2019 2:01 AM
  • User-640622294 posted
    • System.Web.Mvc
    • System.Web.Routing
    • System.Web.Abstractions
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 13, 2019 2:17 PM