Reputation: 150108
Playing around with MVC 4 Beta and its Mobile features, the following line in Login.Mobile.cshtml
@Html.Partial("_ViewSwitcher")
Causes this compiler error:
The call is ambiguous between the following methods or properties: 'System.Web.Mvc.Html.PartialExtensions.Partial(System.Web.Mvc.HtmlHelper, string)' and 'System.Web.Mvc.Html.PartialExtensions.Partial(System.Web.Mvc.HtmlHelper, string)'
Per MSDN this is defined in System.Web.Mvc (in System.Web.Mvc.dll), to which I only seem to have a single reference.
The application runs correctly in spite of the compiler error.
There are no using
statements in the view, though the following namespaces are incorporated via web.config
:
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
What's happening, and how can I get rid of the misleading compiler error?
Upvotes: 2
Views: 726
Reputation: 74
The method is defined in two places is the usual cause for this, it can be from a referenced assembly of a previous build, the compiler will pick the most likely and use it so won't halt processing.
Upvotes: 1