1

In a brand new MVC5 project, I have a single html helper:

public static IHtmlString Localized(this HtmlHelper html, string url)
{
    return /* code here */
}

In an empty page, I attempt to call this:

@{ ViewBag.Title = "Home Page"; }
@Html.Localized("~/content/images/mobile/hero.png");

And I get this error:

CS0121: The call is ambiguous between the following methods or properties: 'EUCA.HtmlHelpers.Localized(System.Web.Mvc.HtmlHelper, string)' and 'EUCA.HtmlHelpers.Localized(System.Web.Mvc.HtmlHelper, string)'

How is one method conflicting with itself?

Chris
  • 27,596
  • 25
  • 124
  • 225

1 Answers1

1

This question has been answered here:
The call is ambiguous between the following methods or properties (bug??)

App_Code causes the code to be compiled twice, which doesn't seem to cause a problem in some basic cases. Extension methods an edge case that does not work with App_Code.

Community
  • 1
  • 1
Chris
  • 27,596
  • 25
  • 124
  • 225