【发布时间】:2014-05-18 17:19:47
【问题描述】:
我创建了一个 ASP.NET MVC 2.0 应用程序。它在第一次测试时运行良好,我对视图进行了一些小的编辑。然后我想添加一个新控制器,所以我必须编译应用程序。在我运行它之后,我得到了以下错误:
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">
我做了一些谷歌搜索,发现了以下教程:http://blog.stevensanderson.com/2009/02/03/using-the-aspnet-mvc-source-code-to-debug-your-app/
我完全按照它,但我仍然得到同样的错误。所以我现在从我的 bin 文件夹中读取 System.Web.Mvc.dll,并且从我的 web.config 中删除了对 GAC 的引用。
从我从其他帖子中收集到的信息来看,我的视图页面或母版页上的继承似乎是问题所在。但我不确定如何编辑它们。
这是从默认 Site.Master MVC 创建的继承
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
这是我认为的继承
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
我正在阅读的论坛帖子说它需要引用后面的代码,但视图中没有代码。它只是一个普通的 Index.aspx 文件。 默认母版页没有代码,但如果我创建一个新的母版页,它会得到一个 .cs 和 .designer.cs
感谢任何帮助,这似乎是一个简单的问题,我错过了一些非常基本的东西。
【问题讨论】: