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

4 posts, 2 answers
  1. Roel Abspoel
    Roel Abspoel avatar
    8 posts
    Member since:
    Nov 2008

    Posted 21 Aug 2013 Link to this post

    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.
  2. Answer
    Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 23 Aug 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Roel Abspoel
    Roel Abspoel avatar
    8 posts
    Member since:
    Nov 2008

    Posted 03 Sep 2013 Link to this post

    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? 
  5. Answer
    Roel Abspoel
    Roel Abspoel avatar
    8 posts
    Member since:
    Nov 2008

    Posted 03 Sep 2013 Link to this post

    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>

Back to Top
UI for ASP.NET MVC is VS 2017 Ready