I just updated the packages in the MVC 3 project (ASP.net 4), and now I get the following error message while accessing the page in this project:
Server error in "/ MyApplication" application.
Failed to load file or assembly 'System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' or one of its dependencies. The installed assembly 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. Look at the stack trace for more information about the error and its occurrence in the code.
Exception Details: System.IO.FileLoadException: Failed to load file or assembly "System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 'or one of its dependencies. The installed assembly manifest definition is not corresponds to the Help assembly. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the exception stack trace below.
Assembly download trace: the following information may be useful to determine why the assembly 'System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' could not be loaded.
=== Pre-binding status information === LOG: User = IIS APPPOOL \ ASP.NET v4.0 LOG: DisplayName = System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35 ( Fully indicated) LOG: Appbase = file: /// C: /.../LOG: Initial PrivatePath = C: ... \ bin Build call: Microsoft.Web.Helpers, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35. === LOG: This binding starts with the default load context. LOG: Using the application configuration file: C: ... \ web.config LOG: using the host Configuration file: C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet.config LOG: Using the machine configuration file from C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Config \ machine.config. LOG: Post-policy link: System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35 LOG: Attempting to load a new URL File: /// C: /Windows/Microsoft.NET/Framework64/ v4.0.30319 / Temporary ASP.NET/.../cb62a7b2/327a0353/System.Web.WebPages.Razor.DLL files. LOG: attempt to load a new URL File: /// C: /Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files /.../cb62a7b2/327a0353/System.Web.WebPages.Razor/ System.Web.WebPages.Razor.DLL. LOG: attempt to load a new URL File: /// C: /LeGroupeHtmSVN/.../UpDir.Web/bin/System.Web.WebPages.Razor.DLL. WRN: comparing the assembly name led to a mismatch: major Version ERR: failed to complete the assembly setup (hr = 0x80131040). Study terminated.
Stack trace:
[FileLoadException: Unable to load file or assembly 'System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' or one of its dependencies. The installed assembly manifest definition does not match the Help assembly. (Exception from HRESULT: 0x80131040)]
Microsoft.Web.Helpers.PreApplicationStartCode.Start () +0
[InvalidOperationException: initializing start before application Method Start as Microsoft.Web.Helpers.PreApplicationStartCode threw an exception with the following error message: Failed to load file or assembly "System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = neutral , PublicKeyToken = 31bf3856ad364e35 'or one of its dependencies. The installed assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods (ICollection`1 methods) +11711966
System.Web.Compilation.BuildManager.CallPreStartInitMethods () +465
System.Web.Hosting.HostingEnvironment.Initialize (ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167
[HttpException (0x80004005): Initialization of the launch before the application The Start method as Microsoft.Web.Helpers.PreApplicationStartCode threw an exception with the following error message: Failed to load file or assembly "System.Web.WebPages.Razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 'or one of its dependencies. The established definition of the assembly manifest does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit (HttpContext context) +11700896 System.Web.HttpRuntime.EnsureFirstRequestInit (HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate (IIS71269 context +)
----------------------------------------------- --- ------------------------------ Version Information: Microsoft.NET Framework Version: 4.0.30319; ASP.NET Version: 4.0.30319.272
In my web.config file and in my application, I refer to System.Web.WebPages.Razor v1.0.0.0:
I donโt even know if I can use System.Web.WebPages.Razor v2.0.0.0 with .Net 4.