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
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
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
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
37 Posts
System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Mar 11, 2019 04:28 PM|reza-2017|LINK
Hi , i have a problem when publishing website
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
All-Star
57864 Points
15488 Posts
Re: System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Mar 11, 2019 07:38 PM|bruce (sqlwork.com)|LINK
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
Contributor
3710 Points
1431 Posts
Re: System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Mar 12, 2019 02:44 AM|Yuki Tao|LINK
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
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
37 Posts
Re: System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Mar 12, 2019 01:08 PM|reza-2017|LINK
doesn't work !
Contributor
3710 Points
1431 Posts
Re: System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Mar 13, 2019 02:01 AM|Yuki Tao|LINK
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:
Hope my reply will helpful to you.
Best Regards.
Yuki Tao
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
37 Posts
Re: System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Mar 13, 2019 02:17 PM|reza-2017|LINK