views:

1512

answers:

3

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'.

  2. 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>
</pages>

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

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?

Thanks, Ray.

A: 

Because you are referencing all the right assemblies and I cannot see anything wrong with your Web.Config file, I wonder if you are referencing the right version of the assemblies. Several versions of ASP.NET MVC have been released already and maybe you are still referencing an earlier version of the System.Web.Mvc.dll (prior to version 1.0.0.0.)?

Seventh Element
+2  A: 

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!

ray247
Could you show how you use Html.ActionLink in your view?
Seventh Element
+1  A: 

The second error is probably due to some error in one of the views. I have experienced similar issues while working with ASP.NET MVC. Compiler errors are not very specific when there is something wrong in a view. So, focus on the views and specifically the code sections where you call Html.ActionLink(). That should eventually take you to the source of the error...

Seventh Element