ASP.NET MVC参考问题? [英] ASP.NET MVC Reference problems?

查看:223
本文介绍了ASP.NET MVC参考问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在做一个MVC项目,我得到了以下2编译错误:

  1. 的类型 System.Web.Mvc.ViewPage 在未被引用的程序集中定义。您必须添加一个引用组件:
  

System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥=空。

<醇开始=2>
  • 的调用不明确以下方法或属性之间:
  •   

    System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper,字符串,字符串,字符串)和System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper,字符串,字符串,字符串)

    我想我有正确的设置在的web.config

     &LT;编译调试=真正的&GT;
      &LT;组件&GT;
        &LT;添加组件=System.Core程序,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
        &LT;添加组件=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Web.Abstractions,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Data.DataSetExtensions,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
        &LT;添加组件=System.Xml.Linq的,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
        &LT;添加组件=System.Data.Linq程序,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
      &LT; /组件&GT;
    &LT; /编译&GT;
     

     &LT;命名空间&GT;
        &LT;加上命名空间=System.Web.Mvc/&GT;
        &LT;加上命名空间=System.Web.Mvc.Ajax/&GT;
        &LT;加上命名空间=System.Web.Mvc.Html/&GT;
        &LT;加上命名空间=System.Web.Routing/&GT;
        &LT;加上命名空间=System.Linq的/&GT;
        &LT;加上命名空间=System.Collections.Generic/&GT;
    &LT; /命名空间&GT;
     

    和,我参考了3的dll我在龙头安装asp.net mvc的有:

      C:\ Program Files文件\微软ASP.NET \ ASP.NET MVC的测试\大会
     

    3的dll:

      System.Web.Abstractions.dll
    System.Web.Routing.dll
    System.Web.Mvc.dll程序
     

    可能有人揭示了什么错误以及如何解决这些名词吗?

    解决方案

    我下载了MVC的最新源关闭的codePLEX和建造它。 \程序Files \ Microsoft ASP.NET \ ASP.NET MVC的测试\大会文件夹:我通过引用System.Web.Mvc.dll程序到我的下载版本,另2的DLL引用的DLL在C固定的第一个错误。

    现在的第一个错误是不存在的,但第二个错误仍然存​​在,这是

    调用不明确以下方法或属性之间:System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper,字符串,字符串,字符串)'和'System.Web.Mvc。 Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper,字符串,字符串,字符串)

    这发生在每个视图页面pretty的多。我能做些什么来解决这个问题?

    感谢你了!

    In doing a MVC project I got the following 2 compile errors:

    1. The type System.Web.Mvc.ViewPage is defined in an assembly that is not referenced. You must add a reference to assembly:

    System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

    1. The call is ambiguous between the following methods or properties:

    System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, string, string, string) and System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, string, string, string)

    I think I have the correct setup in the web.config

    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
    

    and

    <namespaces>
        <add namespace="System.Web.Mvc"/>
        <add namespace="System.Web.Mvc.Ajax"/>
        <add namespace="System.Web.Mvc.Html"/>
        <add namespace="System.Web.Routing"/>
        <add namespace="System.Linq"/>
        <add namespace="System.Collections.Generic"/>       
    </namespaces>
    

    And, I got reference to the 3 dlls I intalled asp.net mvc with in:

    C:\Program Files\Microsoft ASP.NET\ASP.NET MVC Beta\Assemblies
    

    3 dlls:

    System.Web.Abstractions.dll
    System.Web.Routing.dll
    System.Web.Mvc.dll
    

    Could someone shed some light on what is going wrong and how to solve them please?

    解决方案

    I downloaded the latest source of mvc off of CodePlex and built it. I fixed the first error by referencing the System.Web.Mvc.dll to my downloaded version and the other 2 dlls to reference the dlls in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC Beta\Assemblies folder.

    Now that the first error is not there, but the 2nd error still exists which is

    The call is ambiguous between the following methods or properties: 'System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, string, string, string)' and 'System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, string, string, string)'

    this happens on every view page pretty much. What could I do to fix this?

    Thank you so much!

    这篇关于ASP.NET MVC参考问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆