[.net] Windows update caused MVC3 and MVC4 stop working
We had to manually touch each .csproj to update the version from 22.214.171.124 to 126.96.36.199 to get our builds going. Quite a pain.
New references should look like:
<Reference Include="System.Web.Mvc, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
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=184.108.40.206, 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 220.127.116.11, and removes old version from program files folder.
Someone know how to fix this without crawling for each project?
You need to change all the references to System.Web.Mvc within your solution. Just delete them and add the new 18.104.22.168 version.
Also in the properties change
copy local to true.
And in the web.config add the assambly binding to point to the new version of mvc:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-22.214.171.124" newVersion="126.96.36.199" /> </dependentAssembly> </assemblyBinding> </runtime>
For web project, you may have to update the configuration in the web.config as well:
<dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="188.8.131.52-184.108.40.206" newVersion="220.127.116.11"/> </dependentAssembly>
Please see this blog, the recommended way is to update corresponding NuGet package:
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.