Windows update caused MVC3 and MVC4 stop working
Solution 1
The best solution is update DLL to version 4.0.0.1. Try use nuget:
Install-Package Microsoft.AspNet.Mvc -Version 4.0.40804 -Project <your project name>
This will automatically update
<dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" /> </dependentAssembly>
You just have to edit version System.Web.Mvc manually in:
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Solution 2
We had to manually touch each .csproj to update the version from 4.0.0.0 to 4.0.0.1 to get our builds going. Quite a pain.
New references should look like:
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
Solution 3
Had the same issue after update:
Security Update for Microsoft ASP.NET MVC 4.0 (KB2993928)
http://support.microsoft.com/kb/2993928
But only for project with a reference to the System.Web.Mvc, not installed by package.
My colleague, who hadn't installed Microsoft ASP.NET MVC 4.0 Runtime and didn't received the update, had no trouble and had still the reference to 4.0.0.0, not to 4.0.0.1
I manually changed the reference to 4.0.0.1, after check-in, my colleague could still build with a reference to 4.0.0.0.
(Working both on Win7 Pro SP1, VS2013 Pro Update 3)
Solution 4
Please see this blog, the recommended way is to update corresponding NuGet package:
To quote:
The problem can be resolved by implemented one of the following solutions:
(Preferred) Install Microsoft.AspNet.Mvc from the NuGet gallery (this will install a binding redirect in your web.config). You can do this from the NuGet package manager or the NuGet console inside Visual Studio:
Install-Package Microsoft.AspNet.Mvc -Version -Project PROJECTNAME
MVC 4 version: 4.0.40804.0
MVC 3 version: 3.0.50813.1
Manually update the reference to System.Web.MVC.dll (don’t use the one in the GAC).
Try the Add Reference -> Assemblies -> Extensions dialog box.
Solution 5
See this: Microsoft Asp.Net MVC Security Update MS14-059 broke my build! MS blogged about it since it obviously brought a lot of confusion
Yogurtu
Updated on December 09, 2020Comments
-
Yogurtu over 3 years
am i the only one who installed a Windows Update (8.1) on october 15, and suddenly MVC stop working because of this warning?
Warning 1 Could not resolve this reference. Could not locate the assembly "System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
It seems that this windows update installs a newer version of MVC with version number 4.0.0.1, and removes old version from program files folder.
Someone know how to fix this without crawling for each project?
-
abatishchev over 9 yearsYeap, just replace GAC reference with NuGet reference. Worked for us.
-
Andy over 9 yearsNote the same change is needed for MVC 3.0, the reference should be "3.0.0.1" to get that working again.
-
Hanna over 9 yearsRead Microsoft's blog on the matter. (Thanks to e4rthdog for linking to this, just commenting to get more visibility)
-
Danny Tuppeny over 9 yearsSetting
CopyLocal=true
did not help us; see:System.Web.MVC
not copied tobin
folder since MS14-059 -
Farinha over 9 yearsAny idea why, after doing the above, I get a whole bunch of these warnings: "ASPNETCOMPILER : warning CS1702: Assuming assembly reference 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' matches 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35', you may need to supply runtime policy"?
-
StefanHa over 9 years@Farinha, i have the same warnings. I cant get them away. These warnings kill the build performance. Did you find a way to fix this?
-
Farinha over 9 yearsNo @StefanHa, haven't found a fix yet. I noticed there's a bunch of references to 4.0.0.0 throughout the application, in the Web.config files inside the Views folders, but even after manually changing all of those the warning remains.
-
Rob Angelier over 9 yearsThanks for this. I spend over three days trying to fix this arrrrggg. +1
-
East of Nowhere over 9 yearsAh-hah, manually editing that one <add assembly> node, in the Web.config file that's in my Views folder (the main one seemed to be automatically updated, by NuGet I guess) finally ironed out the last of the errors for me in my MVC4 project.
-
LoJo over 8 yearsWhere is that last
<add assembly..
under<compilation..
suppose to go? When I try, it complains that<assemblies>
is an invalid child of<system.web>
. -
pim about 8 yearsIn my case this was required, and also needed to indicate that "Specific Version" is "True"
-
harvzor almost 8 yearsRunning the above command only seems to work in VS15, not in VS13. VS13 cannot find the package.