1

Since upgrading from ASP.NET MVC3 to MVC4 I have run into an issue. The application has a big portion of it's controllers and views embedded into a dll that the main project references and the solution relies on a standard VirtualPathProvider that checks if the requested view exists in the dll and if so returns it.

After upgrading to MVC4 the request for the layout page doesn't go through the VirtualPathProvider anymore, causing the entire application to crash. All of the other views including partial views are handled correctly and are loaded from the assembly.

Has anyone else run into any similar problems after upgrading to MVC4?

Håkan Edling
  • 2,723
  • 1
  • 12
  • 15

1 Answers1

0

I will take a good guess without seeing your error message. Find all the web.config files in your project and make sure reference the latest version of MVC 4.

ATL_DEV
  • 9,256
  • 11
  • 60
  • 102
  • I have gone through all of the config-files and updated everything, and updated every reference with NuGet. Everything else works perfectly, it's just the difference that Layout-pages doesn't seem to go through the VirtualPathProvider in MVC3. – Håkan Edling Jan 27 '13 at 21:57
  • Have you checked the web.config files under your view folders as well? All the assemblies should refer to the same version. You can try this as a quick test: backup your project, delete all of the web.configs recursively with the exception of the root one and make sure you use the exact same MVC dlls (I mean from the EXACT location). Do a full clean and rebuild your project. Beware of .NET 4.5, it's assembly bindings are mysterious, you may have to be very explicit. If the error still occurs, then post it here. – ATL_DEV Jan 28 '13 at 01:59
  • In addition to the aforementioned suggestion, please turn on compiled views post-build step. It will flag possible errors in your views that can cause the route to fail: http://stackoverflow.com/questions/383192/compile-views-in-asp-net-mvc This is only a compile check, not a binary build. – ATL_DEV Jan 28 '13 at 02:07