“System.Web.Mvc.ViewMasterPage” Parser Error
I’m currently working on my first ASP.NET MVC app, code name Biscuit. I edited some Master Pages today and upon starting my app received the following parser error:
The type ‘System.Web.Mvc.ViewMasterPage’ is ambiguous: it could come from assembly ‘C:\Windows\assembly\GAC_MSIL\System.Web.Mvc\188.8.131.52__31bf3856ad364e35\System.Web.Mvc.dll’…
Turns out one of my new Master Pages had .cs and .designer.cs files attached.
As explained in this ASP.NET forum post, the namespace for my .designer.cs file has been changed to: System.Web.Mvc, which is why the site got confused.
The solution for it going forward:
- Change the inherits attribute in the HTML file to your namespace and class name.
- Change the inherit in your class (the cs file, not the designer.cs file) to inherit from System.Web.Mvc.ViewMasterPage instead of the default System.Web.UI.MasterPage.