Skip to the content

Get up and running with Umbraco 8 ModelBuilder API

Before Starting any of these steps you want to first set up a Website Using SQL servers
(if you dont know how to do this go read my blog on "How to install Umbraco 8 using SQL Servers" Link Below)


So now you have Umbraco 8 set up with SQL Servers We can get started.

Step 1. So assuming you now have a website in you visual studio you can run and it all works. Now you need to add a class library. ( Right click on you solution and click "Add" then "New Project" Select "C# Class library (.NET Framework)" Name your new project Website.Core  

Step 2. Now you have your class library created you will need to add a new class under your New Class Library. To do this right click on your Website.core project folder then Click (Add>Class>Blank Class) and name your new Class "ModelsBuilder.cs".

Step 3. Next Its time to set up your custom tool. Right Click on your new class "ModelsBuilder.cs" and click "properties". Type " UmbracoModelsBuilder " to the right of where it says Custom Tool. Now Click "Tools" from your Visual Studio Top Menu and Select options. Scroll through the options until you see Umbraco and click on Umbraco.
Fill out your site URL ( The user name and password is how you sign into your Umbraco 8 back office.) And click OK.

Step 4. Now you need to make sure your web config file is set up properly. Click on your Website.Web Project and to the bottom you should see Web.config open this file in your Visual Studio Viewer. In the app setting sections make sure the 3 ModelsBuilder setting Read the following.

<add key="Umbraco.ModelsBuilder.Enable" value="true" />
<add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing" />
<add key="Umbraco.ModelsBuilder.EnableApi" value="true" />


Step 5. Next you need to upload your nugget packages to install the models builder. Click Tools>Nuget package manager>Nuget Console and then in the console next to PM> Type out the code below

Install-Package Umbraco.ModelsBuilder.Api
/* only one at at time*/
/*you also need to install*/
Install-Package UmbracoCms.Core
Install-Package Umbraco.ModelsBuilder


" **Be Sure To Install On Both .WEB and .CORE Projects** 

Step 6. Now your NuGet Packages are installed. You want to try run your Custom Tool on your Models Builder Class.
To do this Right click on your ModelsBuilder.cs Class and select Run custom Tool if you have followed along correctly so far it should generate some folders for you containing your Umbraco Models. 

Step 7. As long as you have have all your folders generated now you will need to reference Umbraco.Web in your .Core project.

Step 8.Next you want to save everything and Rebuild your site. After rebuild Click Run and If you have Followed along correctly your website should be working as usual.

Tip: if your website is not running as usual you may need to change the page references and the top of each of your views pages.

From: @inherits UmbracoViewPage<Contact>
To: @inherits UmbracoViewPage<Website.Core.Contact>

This will be needed to be done all all your views pages.

About the author

Nathan Reece

.Net MVC Developer | Umbraco Novice

Hey Guys,

I'm an New Developer with a passion for coding. I absolutely love working with Umbraco CMS and appreciate the Umbraco community even more.

I've got 3 years+ .Net experience and 5 years+ experience working in the Web Develepment industry, both coding and marketing job websites. I wanted to use my skills to help give something back to this awesome community and seems like the right place to do just that.

Follow me on social media

If you're an Umbraco professional, partner, employer, recruiter or a passionate Umbraco community builder then I'm more than happy to hear from you. Follow me on my social media channels and please reach out if you have any needs, want help or consultation with anything Umbraco related or just want a general chat.

comments powered by Disqus

Blog Filter

How we can help?

Need help with an Umbraco project?

Need help with a project but not too sure who to approach? Send us your project brief and budget. We will provide a free consultation and can help you gather quotes from the best and most suitable freelancers or agencies.

Looking to hire an Umbraco Professional?

Have you got job vacancy and want to hire an Umbraco professional? Post a job on our website for free. Alternatively let us know your requirements and we will send suitable prospects your way.

Claim your free profile!

Are you an Umbraco Freelance Developer or Umbraco partner that wants to advertise on our site? If you work with Umbraco or registered as an Umbraco partner then you can create a profile for free.

Let's build the Umbraco Community

We're big on building the Umbraco community and we think you guys are awesome! If there's anyway at all we can help then please reach out.