views:

416

answers:

1

I created an ASP.NET MVC 2.0 Application. It ran fine at first test and I made some minor edits to the views. I then wanted to add a new controller so I had to compile the app. After I did anytime I run it I get 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"&gt;

I did some googling and came accross 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 I have the System.Web.Mvc.dll reading from my bin folder now, and the reference to the GAC was removed from my web.config.

From what I can gather from other posts it sounds like my inherits on my view pages, or maybe my master pages, is the issue. But I'm not sure how to edit them.

Here is the inherits from the default Site.Master MVC created

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

And here is the inherits from my view

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

Forum posts im reading say it needs to reference the code behind instead, but the views have no code behind in them. It's just a plain Index.aspx file. The default master page has no code behind, but if I create a new one it gets given a .cs and .designer.cs

Any help appreciated, this seems like such a simple issue and I'm missing something really basic.

+1  A: 

I think you have codebehind for this masterpage.

Change the inherit from System.Web.Mvc.ViewMasterPage instead of System.Web.UI.MasterPage.

I had the same issue, and this had helped me: http://www.alphapapahotel.com/system-web-mvc-viewmasterpage-parser-erro/aspnet/

Jarek
Thanks, this solved it. :)
Duk