Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nathan Reece 62 posts 376 karma points
    Jul 21, 2020 @ 09:54
    Nathan Reece
    0

    Umbraco 8 how to get Models Builder Api Working

    Right so Im trying to set up my models builder on my new project. I have a .Web and .Core project in my solution, I have installed (Install-Package UmbracoCms.Core, Install-Package Umbraco.ModelsBuilder, Install-Package Umbraco.ModelsBuilder.Api) NuGet packages.

    And I have also created a class of ModelsBuilder.cs and added the custom tool property of - "UmbracoModelsBuilder"

    And Configured my tools options with ( URL + UserName + Password )but when i try to run my custom tool I get the error of ("one or more problems with model builder")

    • I have now fixed this thanks to David i have morked his answer as the solution FOR ANYONE ELSE HAVING PROBLEMS I have written a Step by Step Blog on how this is done *

    STEP BY STEP GUIDE: https://www.umbrajobs.com/blog/posts/2020/july/get-up-and-running-with-umbraco-8-modelbuilder-api/ **

  • David Armitage 510 posts 2081 karma points
    Jul 21, 2020 @ 13:39
    David Armitage
    101

    Hi Nathan,

    Actually I had a load of trouble with that. You have to take it step by step.

    I read a few blog articles and each had their own problems.

    From memory here are the steps I took.

    So I usually have two projects. I am guessing you have the same too since wanting to use the ModelsBuilder API. I have a .Web project that contains all the Umbraco stuff. I am then have a .Core project that has all the custom .net stuff.

    Here are the steps.

    1. Install Umbraco.ModelsBuilder.Api nuget package on the .Web project.

      Install-Package Umbraco.ModelsBuilder.Api -Version 8.1.0

    2. Edit your web config with the following.

      <add key="Umbraco.ModelsBuilder.Enable" value="true"/>
      <add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing"/>
      <add key="Umbraco.ModelsBuilder.EnableApi" value="true"/>
      
    3. Make sure your .Core project has UmrbacoCMS.Core installed. This can also be done through nuget.

      Install-Package UmbracoCms.Core

    4. Make sure your .Core project has a reference to Umbraco.Web dll. I usually reference this from the web project.

    5. Make sure your .Web project is referencing your .Core project.

    6. Build and run. I usually 90% of the time get an error here. Something complaining about the System.ValueTuple references in the Core and Web projects are not the same. If you get this it's an easy fix. Open up Nuget package manager and check the versions of System.ValueTuple on both the .Core and .Web projects. My guess is the .Web will be 4.3 and the .Core project will be 4.5. To fix this I simply upgraded the .Web to 4.5 and I haven't seen any issues doing this.

    7. Once the project is running. You then need to installed Umbraco.ModelsBuilder to the .Core project using nuget.

      Install-Package Umbraco.ModelsBuilder

    8. You then need to installed Umbraco.ModelsBuilder.Api to your .Core project using nuget.

      Install-Package Umbraco.ModelsBuilder

    9. Build and run. Hopefully this will work.

    10. Now you need to make sure the ModelBuilder tool is installed into Visual Studio.

    11. Once this is installed you need to enter the domain name, Umbraco Username and password into the Custom Tool setting.

    12. You then need to add a class called ModelsBuilder.cs to your core project. There is some visual studios properties you need to add. Right click on the class in visual studio. Click properties, in the Custom Tool field type UmbracoModelsBuilder.

    13. Once all this is done you can right click on the class and click run custom tool.

    This should work. If not I would revisit all the steps and make sure you haven't missed anything.

    If you follow these steps and also watch Paul's video to fill in any blanks you will be fine. https://www.youtube.com/watch?v=XPGV1vwQ0HU

    Good luck. It takes some getting up and running but well worth it in the long run.

    Regards

    David

  • Nathan Reece 62 posts 376 karma points
    Jul 22, 2020 @ 02:52
    Nathan Reece
    0

    Thanks Dave,

    Sorted it. :)

  • David Armitage 510 posts 2081 karma points
    Jul 22, 2020 @ 03:05
    David Armitage
    0

    Great. Hope that helped.

  • Mikael Axel Kleinwort 154 posts 499 karma points c-trib
    Jul 12, 2021 @ 12:36
    Mikael Axel Kleinwort
    0

    For others with similar problems:

    I had no luck with "Umbraco ModelsBuilder Extension" (v8.1.5). I always received "Cannot find custom tool..." error in Visual Studio.

    After I installed "Umbraco ModelsBuilder Custom Tool" (v8.0.5), everything workd fine.

    What's the difference between the two extensions?

Please Sign in or register to post replies

Write your reply to:

Draft