11

We have an ASP.NET MVC 4 solution with a couple of references that has been building without problems for about 2 years now. However, after installing KB2993928 and KB2993937 this morning, we cannot run FxCop on this solution on our Windows 7 machines anymore.

I have a feeling this is because this update changed the DLL version of the System.Web.Mvc assembly in the GAC. This is because in the GAC I can currently find 3 different System.Web.Mvc DLLs, which are all updated today.

The error we receive in the build is as follows:

6>MSBUILD : error : CA0001 : The following error was encountered while reading module 'FrontEnd.Implementation': Assembly reference cannot be resolved: System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. [C:\Project\FrontEnd\02-Implementation\02-Implementation.csproj]
6>MSBUILD : error : CA0058 : The referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be found. This assembly is required for analysis and was referenced by: S:\Deliverables\FrontEnd\bin\FrontEnd.Implementation.dll. [C:\Project\FrontEnd\02-Implementation\02-Implementation.csproj]

Since we use ASP.NET MVC 4, this version 3.0 DLL is referenced indirectly by one of our references. For instance, RazorGenerator references version 3.0.0.0. Possibly others as well. There is no new version of RazorGenerator from what I can tell.

The System.Web.Mvc versions I see in the GAC are: 3.0.50813.1, 4.0.40804.0 and 5.0.20821.0.

I removed the reference to System.Web.Mvc from our projects and added Mvc as a NuGet package instead. This fixes our compilation, but FxCop still doesn't work due to the indirect references.

If any additional information is required please let me know.

Olaf Keijsers
  • 566
  • 4
  • 16

6 Answers6

1

Solution:

  1. Uninstall the MVC Framework via "Programs and Features" (whichever version you're using)
  2. Re-install MVC Framework (http://www.asp.net/mvc/mvc4)

Should fix the problem - no changes to the build/solutions is required.

David Airapetyan
  • 5,301
  • 4
  • 40
  • 62
  • I'll try this. Will we have to do this on our build server as well? – Olaf Keijsers Oct 15 '14 at 19:08
  • Likely. We have not patched our build server yet but I cannot see how you can avoid this step. – David Airapetyan Oct 15 '14 at 21:00
  • I tried this already, but it installs 4.0.20710.0, and I need to get back to 4.0.30319.0. Any advice on this? – Lee Grissom Oct 15 '14 at 23:33
  • I don't think this is the same thing. The issue is Security Update for MVC 4.0 was done to update the library to 4.0.0.1. If you have silent Windows updates on, this was done behind the scenes on you. Forcing any projects to stop working if they are explicitly referenced by version in the project. – Sean Oct 15 '14 at 23:34
  • Lee - how do you reference the MVC assembly? We reference it by the major version, something like "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" (for MVC3). When done this way, the workaround above works. I guess if you specifically target 4.0.30319.0 then you will be broken by the patch and the re-install won't help. – David Airapetyan Oct 16 '14 at 00:08
  • 1
    Ew... looks like there was *another* update on October 16 (KB 2993937) that broke it for us again. – David Airapetyan Oct 16 '14 at 16:47
  • @DavidAirapetyan, you're right. I can compile now, I just wanted to be on the same version as the rest of my team. No big deal. – Lee Grissom Oct 16 '14 at 17:23
  • I am afraid my "solution" is flawed - re-installing MVC essentially rolls back the update. However, changing the solution reference could be dangerous because of deployment - our code runs on Azure and depending on when Microsoft patches our environment, we may or may not break it. – David Airapetyan Oct 16 '14 at 19:01
  • That's why I think you should probably just include the System.Web.Mvc.dll in your deployment. We changed to doing that and we can now compile and run the solution again. However, the problem with FxCop remains due to indirect references to the X.0.0.0 versions. – Olaf Keijsers Oct 17 '14 at 09:27
1

This was done by a security update on October 15th from Windows Update. You will need to run the updates on your build servers too.

Link to update: http://www.microsoft.com/en-ie/download/details.aspx?id=44533

This update fixes other versions as well.

You will likely have to update your projects to the newer version, as it changes the version number and removes the older version completely.

Sean
  • 2,496
  • 7
  • 32
  • 60
1

Remove any references to System.Web.MVC and then re-add them by manually browsing to the dll (C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_5.1.0.0__31bf3856ad364e35\System.Web.MVC.dll on our machine). A lot faster than re-installing MVC if this has just taken your production server down!

Gumbo
  • 81
  • 1
  • 2
  • We did that (except I added the NuGet package for MVC as I think that's the better solution), but the problem remains that we have indirect references to the older version. We cannot fix those in this way. – Olaf Keijsers Oct 17 '14 at 09:25
  • We used this to "revert" the update. (wuse \uninstall won't work). Thanks – Julian Oct 17 '14 at 11:33
1

The security updates update the assembly version of system.web.mvc.dll. You need to update your csproject to correct the version. Check this post: ASP.NET MVC security patch to version 3.0.0.1 breaks build

Community
  • 1
  • 1
mattfei
  • 498
  • 3
  • 5
1

If this issue is caused by references which in turn have dependencies on those specific assemblies, you can remedy this by coercing FxCop to use only the StrongName and ignore the version number. This solution is described here.

Of course the real solution would be to update the referenced assemblies (with the indirect dependencies) to newer versions.

Peter
  • 171
  • 4
0

I used the following solution and it's work perfectly:

https://stackoverflow.com/a/26490590

(don't forget to select the default project on the Package Manager Console for each project with the build failed)

Community
  • 1
  • 1
Ephy L
  • 69
  • 5