Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For MVC 4, what's the difference between Microsoft.AspNet.Mvc and System.Web.Mvc?

I have my own server and am looking at upgrading one of my solutions to ASP.NET MVC 4, before upgrading the rest (3+).

As part of this I downloaded the standalone installer for ASP.NET MVC 4 and ran it on my Server 2008 R2 box, since Web Platform Installer 4.0 has the tools update, which wants to install Express and a slew of other applications.

That installer created a C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies directory with System.Web.Mvc.dll.

I went through the manual upgrade notes for MVC 3 to MVC 4 and I've just run across item 3:

In Solution Explorer, right-click on the References and select Manage NuGet Packages. In the left pane, select Updates\All, then update the following:

  • ASP.NET MVC 4
  • (Optional) jQuery, jQuery Validation and jQuery UI
  • (Optional) Entity Framework
  • (Optonal) Modernizr

From what I can tell ASP.NET MVC 4 refers to this NuGet package, which is now contained in Microsoft ASP.NET MVC 4 (Microsoft.AspNet.Mvc), and seems to be for installing on shared hosting, and cloud platforms.

Or am I missing something? Is there a reason to install this package even if I my own server, and can install/update .NET Frameworks as I wish?

EDIT: Note that checking the headers (I haven't switched it off yet) does show that the version of MVC for the site is 4.0, and that's without the NuGet package. Is it fixes/features that just haven't been pushed into the core package? Is it primarily for shared hosting environments? If I keep it, will it result in some loss of performance (I'd consider needlessly increased memory usage to be covered by that) if MVC 4 is already installed?

like image 729
James Skemp Avatar asked Aug 24 '12 00:08

James Skemp


1 Answers

As far as I can tell, they are exactly the same. Even though the NuGet package is called Microsoft.AspNet.Mvc, the dll file it creates is named System.Web.Mvc.dll. It has the same size, assembly signature, etc. as the System.Web.MVC file in the GAC.

So for now, even if you reference both assemblies, .NET should recognize that they are exactly the same, and only load one of them. It's possible that Microsoft is pushing the NuGet package to make it easier to upgrade as new versions come out that aren't based on the core .NET 4.5 files. Or perhaps, as you are guessing, the NuGet package makes it so you can run an MVC application on a system where you're not allowed to install MVC.

like image 98
StriplingWarrior Avatar answered Oct 11 '22 14:10

StriplingWarrior