c# - The call is ambiguous: Html.LabelFor -
i upgraded mvc3 application mvc4 , getting error @ runtime. (trimmed down better)
error cs0121: call ambiguous between following methods or properties: '
mywebcore.htmlhelperextensions.labelfor<coreviewmodel,string>(system.web.mvc.htmlhelper<coreviewmodel>, system.linq.expressions.expression<system.func<coreviewmodel,string>>, object)
' and
'system.web.mvc.html.labelextensions.labelfor<coreviewmodel,string>(system.web.mvc.htmlhelper<coreviewmodel>, system.linq.expressions.expression<system.func<coreviewmodel,string>>, object)
'
i have own labelhelperextensions
class contains labelfor
method. both of web.config files have references mvc4 in them. how can use extension methods instead of mvc ones?
my web.config: add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35
my views/web.config: add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" namespace="system.web.mvc" tagprefix="mvc"
i have own labelhelperextensions class contains labelfor method. how can use extension methods instead of mvc ones?
not option, renaming method avoid collision known extension method cleanest. call static method directly (prefacing method static class name) defeat purpose of using extension method.
Comments
Post a Comment