ASP.NET MVC Versions–Microsoft.AspNet.Mvc

While creating a new web application targeting .NET Framework 4 we see a dialog like the following.  Great all good right. 
image

What is Microsoft.AspNet.Mvc? What is System.Web.Mvc.dll?  Are these related…in short yes.  I had some confusion as to the relationship between System.Web.Mvc and the Nuget package Microsoft.AspNet.Mvc.  Here is how….

Yes, they are very much related.  Do things have to be this confusing?  So tracking this down, I created a new out of the box Asp.Net MVC Application.  Afterwards, I opened up Nuget Manager in order to review what packages were installed.  I see a number of packages needing updating.  In particular, I see one Microsoft.AspNet.Mvc however I do not see this assembly in my project references.  Remember - Nuget packages can and do include one or more assemblies(dll’s) and can be named differently than the package name.  In this particular case, the package Microsoft.AspNet.Mvc contains the System.Web.Mvc.dll.  For the record, the project when created referenced this package..<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />  (this package includes the System.Web.Mvc.dll Runtime Version v4.0.30319, Version 4.0.0.0 and specifically Product version 4.0.20710.0 shown via file properties)

Inside the out of box .NET 4, MVC application we have…

image  image 

Looking at the System.Web.Mvc.dll that was deliver with the new .NET 4 application we have the following dll.  In addition if we look at the existing Nuget packages in the application we have the following package <package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />

image

Now, we will update the Microsoft.AspNet.Mvc version 4.0.30506.0 package to 4.0.40804.0 to see what occurs.

image

The package in the packages file was updated to <package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net40" />  Looking at the project references after the update we can see System.Web.Mvc Runtime version 4.0.30319 and Version 4.0.0.1.  Note: the file in the bin directory is not updated until after a project build.  Now looking at the file properties we can see File version 4.0.40804.0 and Product version 4.040804.0
image  image

In summary…

Before

Nuget Package: <package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
Project Reference: System.Web.Mvc.dll Runtime Version v4.0.30319, Version 4.0.0.0
File System: Product version 4.0.20710.0

After

Nuget Package: <package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net40" />
Project Reference:System.Web.Mvc Runtime version 4.0.30319 and Version 4.0.0.1
File System:File version 4.0.40804.0

We also have to note that the web.config was updated by the Nuget package, notice below the newVersion is 4.0.0.1
<dependentAssembly>
  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
  <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>

Author

david

comments powered by Disqus