Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong System.Web.Mvc update

Tags:

asp.net

nuget

I had System.Web.Mvc v4.0.0.0 added in the GAC, so I installed manually Mvc via nuget with "Install-Package Microsoft.AspNet.Mvc -Version 5.2.3".

I have installed System.Web.Mvc v5.2.3.0 now, NuGet manager

and System.Web.Mvc v4.0.0.0 in the GAC GAC

I have this in Web.config:

 <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>

I build and run the project and I get the next error:

Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

But I have configured and added MVC v5.2.3.0 package . Why this error appears?

SOLVED Dereference System.Web.Mvc References -> Right click -> Mange NuGet Packages... -> Uninstall MVC -> And now "Install".

like image 256
Joe Avatar asked Oct 31 '22 05:10

Joe


1 Answers

The assembly you see listed is from the GAC. That doesn't necessarily mean you're using it in the project. If you want to see the actual package installed in your project, right click the project and click "Manage NuGet Packages".

Uncheck version 4 on the Add Reference screen, then use the Package Manager Console to install the specific version via NuGet. Make sure you have the correct project selected to install the package into.

like image 146
mason Avatar answered Nov 15 '22 07:11

mason