21
votes

I'm using umbraco 4.11.3 in my project.My project work well util that's on Windows 7 and run it from visual studio 2012. But it did not work in Win 8 when it run from visual studio 2012!

Error is:

Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

=== Pre-bind state information === LOG: User = Jahan-PC\jahan LOG: DisplayName = System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///G:/20130204/SourceCode/Defraz.Movafaqiyat.WebApp/Defraz.Movafaqiyat.WebApp/ LOG: Initial PrivatePath = G:\20130204\SourceCode\Defraz.Movafaqiyat.WebApp\Defraz.Movafaqiyat.WebApp\bin Calling assembly : ClientDependency.Core.Mvc, Version=1.5.1.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: G:\20130204\SourceCode\Defraz.Movafaqiyat.WebApp\Defraz.Movafaqiyat.WebApp\web.config LOG: Using host configuration file: C:\Users\jahan\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Users/jahan/AppData/Local/Temp/Temporary ASP.NET Files/root/bc5b37d0/42db0b24/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Users/jahan/AppData/Local/Temp/Temporary ASP.NET Files/root/bc5b37d0/42db0b24/System.Web.Mvc/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///G:/20130204/SourceCode/Defraz.Movafaqiyat.WebApp/Defraz.Movafaqiyat.WebApp/bin/System.Web.Mvc.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Stack Trace:

[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler() +0
ClientDependency.Core.Module.ClientDependencyModule.b__0(IFilter f) +31 System.Linq.Enumerable.Any(IEnumerable1 source, Func2 predicate) +146
ClientDependency.Core.Module.ClientDependencyModule.ValidateCurrentHandler(IEnumerable`1 filters) +127
ClientDependency.Core.Module.ClientDependencyModule.HandleRequest(Object sender, EventArgs e) +179
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Note:published project on IIS works well in win7 and win8. My project isn't based on ASP.NET MVC. Please help me.

4
is .NET 2.0 support installed into your IIS web server? if so is the application setup to use the correct Application Pool? with this .Net 3.5 support should be added and then you need the ASP.NET MVC Framework i would recommend installing 1,2,3 & 4 in that order to keep the files in placeBarkermn01
@MartinBarker Downloading all the MVC versions is not the way to resolve this issue, as it will just be masking a potential problem, and potentially propagating this same issue across this user's future projects.Digbyswift
@MartinBarker:Thanks alot. I installed ASP.NET MVC2 from microsoft.com/en-us/download/details.aspx?id=22079 on win8 and my problem was solved.Said Roohullah Allem
@Jahan not help at all, this assembly is part of release, iam surprised that it solved the issue, maybe because your binaries were included into GAC after mvc2 installationstenly
I had this problem and found the accepted solution to this question to work: serverfault.com/questions/283818/…Morten Jensen

4 Answers

13
votes

We're using Azure cloud to run a deployment and I got the same error. Since you can't really install packages onto the server instances, the way to solve this is to go into References for your project, find the reference to the library that it's complaining is missing, go into properties, then set Copy Local to True. Redeploy and you're all set.

7
votes

The correct fix for this issue is to:

  1. Right-click on References in your Solution Explorer and choose Manage NuGet Packages
  2. On the left side select Updates
  3. In the middle section select Microsoft ASP.NET MVC
  4. You should see an Update button appear in your selection, click on it

That's it...accept any T&Cs that might pop-up and either publish or run your project locally. If you're still having problems running your project locally, try closing Visual Studio deleting the .SUO file for the project and try opening the solution again...try running again.

6
votes

I'm assuming this is a new machine, seeing as you have the new OS and different version of Visual Studio. I think you need to install MVC Framework version 2, as that's what your Umbraco install is expecting. You can either install the Framework, and get the DLLs into your GAC, or copy the DLLs from your good system to the bin folder of your web application.

Note, you're saying your project "doesn't use" MVC, but I think you'll find Umbraco does. The error, at any rate, is telling you that the system expects to find it.

3
votes

Umbraco 4.11.3 doesn't use MVC2, it uses MVC3 so I would guess that you have a reference in your web.config to the MVC2 library, possibly in the compilation > assemblies section. It should look something like this:

<compilation defaultLanguage="c#" batch="false" targetFramework="4.0" debug="true">
  <assemblies>
    <!-- ASP.NET 4.0 Assemblies -->
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
  <!-- Added in Umbraco 4.6.2 -->
  <buildProviders>
    <add extension=".cshtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
    <add extension=".vbhtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
    <add extension=".razor" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
  </buildProviders>
  <!-- End of added in Umbraco 4.6.2 -->
</compilation>