This is a migrated thread and some comments may be shown as answers.

Updating MVC4 project to latest Kendo UI gives: The call is ambiguous

3 Answers 109 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roel Abspoel
Top achievements
Rank 1
Roel Abspoel asked on 21 Aug 2013, 08:22 AM
I have an MVC4 solution where the models are placed inside a different project. Only one project inside the solution uses Kendo UI and with the latest release i I wanted to update the Keno UI from Q2 2012 to the latest Q2 2013. On any page where i use the html helpers (mvc wrapper) i now get the runtime error:

The call is ambiguous between the following methods or properties:
'Kendo.Mvc.UI.HtmlHelperExtension.Kendo<Pytheas.Domain.Models.mdlSpreekuur>(System.Web.Mvc.HtmlHelper<Pytheas.Domain.Models.mdlSpreekuur>)'
and
'Kendo.Mvc.UI.HtmlHelperExtension.Kendo<Pytheas.Domain.Models.mdlSpreekuur>(System.Web.Mvc.HtmlHelper<Pytheas.Domain.Models.mdlSpreekuur>)'

Where the model name is different for every page. If i remove the control (grid, menu, etc) all is fine and the page loads. If i then add for instance the sample code for the menu wrapper:

@(Html.Kendo().Menu()
    .Name("menu") //The name of the menu is mandatory. It specifies the "id" attribute of the widget.
    .Items(items =>
    {
        items.Add().Text("Item 1"); //Add item with text "Item1")
        items.Add().Text("Item 2"); //Add item with text "Item2")
    })
)


I again get the mentioned error, regardless if the control uses data or not it gives me this error. I have checked all script/css files and ofcourse the referenced assembly both in the project as in the build. Creating a new MVC project and adding Kendo.UI with the wrappers works fine though, it seems to be isolated to my project specificly.

Does anyone have a clue what's going on and how i can fix this?

Edit:  If i dont use the wrapper then i can use the controls without a problem.

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 23 Aug 2013, 08:44 AM
Hello Roel,

The observed error occurs when you call a method, which belongs to multiple different namespaces. Since the namespace is the same in this case, please make sure that you are not referring multiple different versions of the same assembly in your solution.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Roel Abspoel
Top achievements
Rank 1
answered on 03 Sep 2013, 08:29 AM
Thanks for the reply, but like stated i've checked the assembly version in the project and it points to the correct version. 

To clarify, what i did to update:

  • I've downloaded and installed the Q2 2013 version. 
  • Opened up my solution (with 1 webproject that uses Kendo.Mvc).
  • Copied the scripts and other resources to the corresponding folders. 
  • Removed the old reference (in the web project) and added the new reference. (browsed from disk).
  • Cleaned the solution and build the entire solution.
  • Checked the Bin folder to see if the correct dll was copied.
No other projects in this solution use or have the reference.

Error persists :(

Did i miss something? 
0
Accepted
Roel Abspoel
Top achievements
Rank 1
answered on 03 Sep 2013, 11:28 AM
Ok found it..

In my Web.config under the project i still had the wrong version referenced.
<system.web>
    <assemblies>
      <add assembly="Kendo.Mvc, Version=2012.2.913.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4, processorArchitecture=MSIL" />
    </assemblies>
</system.web>
Should have been 
<system.web>
    <assemblies>
      <add assembly="Kendo.Mvc, Version=2013.2.716.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4, processorArchitecture=MSIL" />
    </assemblies>
</system.web>
And the Web.config under the Views:
<system.web>
      <controls>
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
        <add assembly="Kendo.Mvc, Version=2012.2.913.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4, processorArchitecture=MSIL" namespace="Kendo.Mvc.UI" tagPrefix="Ken"/>
      </controls>
   </pages>
</system.web>
Should have been:
<system.web>
      <controls>
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
        <add assembly="Kendo.Mvc, Version=2013.2.716.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4, processorArchitecture=MSIL" namespace="Kendo.Mvc.UI" tagPrefix="Ken"/>
      </controls>
   </pages>
</system.web>

Tags
General Discussions
Asked by
Roel Abspoel
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Roel Abspoel
Top achievements
Rank 1
Share this question
or