ASP.NET MVC Ambiguous type error - "System.Web.Mvc.ViewMasterPage" is ambiguous
I have created an ASP.NET MVC 2.0 Application. It ran great on first test and I made some minor changes to the views. Then I wanted to add a new controller, so I had to compile the application. After doing this at any time, I run the following error:
Parser Error Message: The type 'System.Web.Mvc.ViewMasterPage' is ambiguous: it could come from assembly 'C:\Users\DerekM\Documents\Visual Studio 2008\Projects\ABELMedicalSoftwareMVC\ABELMedicalSoftwareMVC\bin\System.Web.Mvc.DLL' or from assembly 'C:\Users\DerekM\Documents\Visual Studio 2008\Projects\ABELMedicalSoftwareMVC\ABELMedicalSoftwareMVC\bin\ABELMedicalSoftwareMVC.DLL'. Please specify the assembly explicitly in the type name.
Source Error:
Line 1: <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
I did some searches and came up with the following tutorial: http://blog.stevensanderson.com/2009/02/03/using-the-aspnet-mvc-source-code-to-debug-your-app/
I followed it exactly, but I still get the same error. So now I have the System.Web.Mvc.dll file from the bin folder and the GAC reference has been removed from my web.config.
From what I can gather from other posts, this is similar to my inheritance in my view pages, or maybe my master pages. But I'm not sure how to edit them.
Here is the inheritance from the default Site.Master MVC
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
And now my views are inherited
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
The posts in the forums I read say to reference the code instead, but there is no code in them. This is a simple Index.aspx file. There is no code on the default master page, but if I create a new one it will be given .cs and .designer.cs
Any help is appreciated, it seems like such a simple issue and I am missing something really basic.
a source to share
I think you have the code for this master page.
Change inheritance from System.Web.Mvc.ViewMasterPage instead of System.Web.UI.MasterPage.
I had the same problem and this worked for me: http://www.alphapapahotel.com/system-web-mvc-viewmasterpage-parser-erro/aspnet/
a source to share