Fix: The type 'System.Web.Mvc.ViewPage' is ambiguous:

Once again, my lack of attention leads to a blog post.

This time, an MVC2 project I’m working on started to misbehave with the error “The type 'System.Web.Mvc.ViewPage' is ambiguous:”

For some reason, it was pointing to the logon.aspx page:

Line 1: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> Line 2: Line 3: <asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">

After the usual gnashing of teeth and denial that I did anything to cause it, I settled down to backtrack at what had changed. I had absent-mindedly added a page to the project. It turns out it WASN’T an MVC page but a Webforms page!


Excluding the errant webforms page (and its associated code-behind) cleared up the problem. My fault for sure, but the error message really wasn’t helpful.

Added to the list of dumb mistakes that I admit so you don’t have to…

No Comments