I tinkered with my ASP.NET MVC4 packages via NuGet, and now System.Web.WebPages.Razor v3
won't load. Sometimes other packages won't load either.
My coworker runs the solution without any trouble, so the issue is definitely configuration on my development system (as opposed to anything that's been checked in).
I have already tried the recommendations at various SOf and other fora links, including:
- Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0,
- Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0
- Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0
As well as suggestions linked from there. I also checked the Control Panel and found no installed programs that referenced MVC. (If it matters, I'm running MS Win 7 SP 1.)
I am open to any and all suggestions.
Here's my core dump info:
Server Error in '/' Application.
Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
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.FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
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.WebPages.Razor,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information === LOG: User = CodesWithHammer LOG: DisplayName = System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/ LOG: Initial PrivatePath = c:\users\CodesWithHammer\documents\visual studio 2012\Projects\MPP\MPP\bin Calling assembly : Microsoft.Web.WebPages.OAuth, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
=== LOG: This bind starts in default load context. LOG: Using application configuration file: c:\users\CodesWithHammer\documents\visual studio 2012\Projects\MPP\MPP\web.config LOG: Using host configuration file: C:\Users\CodesWithHammer\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.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor.EXE. LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor/System.Web.WebPages.Razor.EXE. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor.EXE. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor/System.Web.WebPages.Razor.EXE.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization method Start on type
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection
1 methods, Func
1 setHostingEnvironmentCultures) +550 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90 System.Web.Compilation.BuildManager.ExecutePreAppStart() +135 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516[HttpException (0x80004005): The pre-application start initialization method Start on type
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055
(For those who read this far: I don't have enough reputation to make the tag pulling-out-my-hair. If there's an appropriate extant tag, please include that. KTHX.)
ETA: When I tried manually updating Microsoft.AspNet.Mvc
to version 3, here's the error I got on Package Manager Console:
Install failed. Rolling back... Install-Package : Updating 'Microsoft.AspNet.Mvc 5.0.0' to 'Microsoft.AspNet.Mvc 3.0.20105.1' failed. Unable to find a version of 'Microsoft.AspNet.Mvc.FixedDisplayModes' that is compatible wi th 'Microsoft.AspNet.Mvc 3.0.20105.1'. At line:1 char:16 + Install-Package <<<< Microsoft.AspNet.Mvc -Version 3.0.20105.1 + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
ETA2: I got the packages directory from my coworker. They have MS.AspNet.Mvc
v5, and they're running just fine. But they ALSO have MS.AspNet.Mvc.FixedDisplayModes
v5. So I'm going to add both of those in. And yes, I have backed up my entire solution. :)
ETA3: So I re-upgraded to AspNet MVC v5, and skipped the deprecated Mvc.FixedDisplayNodes. Then I got a problem with conflicting versions of AspNet.WebPages, so I used this fix: Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0" in ASP.MET MVC 3
And now my project runs!
Thanks all for the help!