如何在DLL引用中更具体?

时间:2016-07-22 14:45:39

标签: c# asp.net-mvc webforms

出现此错误:

Parser Error Message: The type 'System.Web.Mvc.ViewPage' is
ambiguous: it could come from assembly
'\\vmware-host\shared folders\documents\visual studio 2015\Projects\ClientApp\ClientApp\bin\
      Boilerplate.Web.Mvc5.Sample.DLL'
or from assembly
'\\vmware-host\shared folders\documents\visual studio 2015\Projects\ClientApp\ClientApp\bin\
     System.Web.Mvc.DLL'.
Please specify the assembly explicitly in the type name.

从这段代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="System.Web.Mvc.ViewPage" %>

如何在DLL引用中更具体?

仅供参考,我的控制器是一个MVC 5控制器,其动作如下所示:

    public ActionResult Index()
    {

        var view = new WebFormView(this.ControllerContext, "~/Views/Conduces/Index.aspx");

        return View(view);

1 个答案:

答案 0 :(得分:1)

您可以将程序集名称包含在Inherits属性值的一部分中:

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage,System.Web.Mvc" %>

请注意首先是类型名称的两部分名称,然后是程序集名称。