views:

259

answers:

2

I'm pretty new in ASP.NET MVC (about 3 months) and i've the followin issue:

I have a Entity Class called 'Usuario' in a ClassLibrary referenced as 'Core' and, when i create a strongly-typed view and add a html.textboxfor<> like:

<%= Html.TextBoxFor(u => u.Login) %>

it raises the following error:

Error   3   The call is ambiguous between the following methods or properties:
'Microsoft.Web.Mvc.ExpressionInputExtensions.TextBoxFor<Core.Usuario,string>(System.Web.Mvc
.HtmlHelper<Core.Usuario>, 
System.Linq.Expressions.Expression<System.Func<Core.Usuario,string>>)' and 
'System.Web.Mvc.Html.InputExtensions.TextBoxFor<Core.Usuario,string>(System.Web.Mvc.HtmlHel
per<Core.Usuario>,     System.Linq.Expressions.Expression<System.Func<Core.Usuario,string>>)'   
d:\Documents\Visual Studio 
2008\Projects\GuiPereiraMVC2\GuiPereiraMVC2\Views\Gestao\Index.aspx 20  25  

GuiPereiraMVC2

anyone knows why?

A: 

You have several (at least two) versions of MVC assemblies mentioned in your web.config. Take a look there.

Fyodor Soikin
The Microsoft.Web.Mvc gives the 'Html.Submit', which i'm using.... the System.web.mvc version is the follow: <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>is it deprecated? what do i have to do?
GuiPereira
You have to get rid of Microsoft.Web.Mvc. Leave only the "System" one.
Fyodor Soikin
+2  A: 

Sure, simple :)

You probably recently updated your version of MVC 2. In your web project, you have the reference to Microsoft.Web.Mvc (the MVC Futures assembly).

Some of the methods from it have been moved to the core assembly, making the reference to Microsoft.Web.Mvc unnecessary. You can easily remove it now :)

Btw.. Some of the methods haven't been moved, like the Html.Css / Html.Script helpers. But if you didn't use them - you'll be fine :) Also, you might try to update your Microsoft.Web.Mvc library if you still need it. I guess they would have removed these methods from the Futures library since the official release!

Artiom Chilaru
The Microsoft.Web.Mvc gives the 'Html.Submit', which i'm using....the core do not have some of this kind of helpers that i need... is it out-of-date?
GuiPereira
It might be... try go to the Mvc Futures website, and download the latest build from there )
Artiom Chilaru