Reputation: 12441
In doing a MVC project I got the following 2 compile errors:
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.
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?
Upvotes: 2
Views: 6720
Reputation: 3244
Second error is because the IDE is getting the referance from two different sources. As a result it cant decide which one to pick.
I had System.Web.Mvc and System.Web.Mvc.Html added to the namespace section web.config file. I removed the System.Web.Mvc.Html and it got fixed.
Here is the screenshot if anyone is facing the same problem:
Upvotes: 0
Reputation: 5027
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...
Upvotes: 1
Reputation: 12441
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!
Upvotes: 2
Reputation: 5027
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.)?
Upvotes: 0