After yesterday\'s Windows Update, I seem to have issues building my projects.
Related Windows Updates could be:
ASP.NET MVC 2.0: KB2993939
ASP.NET MVC 3.0:
Try to install/repair ASP.NET MVC using the last versions of MSI packages available from here.
If you use bindingRedirect
in web.config
it could be required (it was not needed in my projects) to update the sections too. See the answer. It all still not helps I would recommend to examine other web.config files in your project, like ~/Views/web.config
for example.
There are two ways to fix this:
Option 1: Add Microsoft.AspNet.Mvc using NuGet
Use NuGet to add the latest revision of the MVC version you depend on to your project. Microsft recommends this approach.
Option 2: Update assembly reference
If you add a new assymbly reference to your project you'll see that the System.Web.Mvc assemblies are now versioned x.0.0.1.
Source: http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx
I would suggest against bluntly attempting reinstalling MVC. Allthough it worked for me in the end, you'll run into trouble with NuGet being bundled with the MVC installer.
You need to uninstall NuGet prior to reinstalling MVC because NuGet still being present causes the MVC installer to refuse to install or to fail.
In addition I don't see why reinstalling MVC will prevent Windows Update from applying the update again after you reinstalled MVC.
This issue was present for me. However, the fix was much more simplified than using nuget to fix or making updates to web.config. My issue was resolved by manually updating the text in {ProjectName}.csproj from
Reference Include="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
to
Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" , and checking in the changes, and running a build in the build agent machine, which, for me, was TeamCity.
Even though this caused build errors locally, it resolved the source control/Team City build errors.
I realize that this doesnt allow me to build locally, without having making changes to the csproj file. However, after I checkin the change as I did above(changing it from 3.0.0.1 to 3.0.0.0), I can update the project locally to use the new version (3.0.0.1), and just not check in the changes to csproj. I imagine someone may have a similar scenario.
I tried mh28's solution, which proposed the following:
The recent updates have incremented version numbers
3.0.0.0 -> 3.0.0.1 and 4.0.0.0 -> 4.0.0.1
I had to remove the reference and re-add (System.Web.Mvc is found in Assemblies >Extensions are of the Add Reference dialogue)
On top of that, it was also suggested that I run a Find and Replace throughout my scope of interest; I tried that, but failed. Seems like Find and Replace doesn't apply to .csproj files.
What I did next was to find a text replacing tool (see Ecobyte Replace Text) and run the program using the following settings:
All my projects built as per normal thereafter, and I'm not seeing any side effects (despite not making any changes in the web.config
files). I'm not sure (and I don't think) this is the best solution, and I don't think this is a silver bullet for all System.Web.Mvc
issues affected by the security-related Windows Update for .NET, but I think it'd be useful for specific cases whereby there're a whole lot of projects to re-reference.