Skip to Main Menu

microsoftwebmvc vs systemwebmvc

Today I got a failed build due with an ambiguous call to extensions between Microsoft MVC and System MVC this is due to ongoing work moving references between the two.

The easiest way I saw to fix this in pages was to wrap it into another class so I can only include one of them.

What was, for example:

<%= Html.HiddenFor(x=>x.Field) %>


<%= NewClass.HiddenField(Html) %>

In the code:

public string HiddenField(HtmlHelper helper)
    return helper.HiddenFor(x=>x.Field);

Besides the obvious notion of removing logic from the page we also removed the static reference and can test the write method or mock it for other scenarios, even if we end up with only one library using HiddenFor and other extensions this looks like a good option