Copied to clipboard

Flag this post as spam?

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


  • Jeff Subat 28 posts 159 karma points
    Jan 05, 2017 @ 16:04
    Jeff Subat
    0

    Models Builder with Umbraco Cloud?

    Is it possible to use the Models Builder with Umbraco Cloud? Here are the issues, as I see them:

    • When I pull the site, I get a website, not a web app.
    • In ASP.NET websites, all code has to go in the App_Code folder. It gets compiled into a single assembly at run time.
    • Models Builder puts the generated models in the App_Data folder, so the classes don't get compiled.
  • Søren Kottal 702 posts 4497 karma points MVP 5x c-trib
    Jan 05, 2017 @ 18:47
    Søren Kottal
    101

    You can use the dll mode. That will generate a dll in your bin folder.

    Or you can set your output location to App_Code via the Umbraco.ModelsBuilder.ModelsDirectory setting.

    https://github.com/zpqrtbnk/Zbu.ModelsBuilder/wiki/Install-And-Configure

  • Jeff Subat 28 posts 159 karma points
    Jan 09, 2017 @ 21:38
    Jeff Subat
    0

    I set ModelsDirectory to a folder under App_Code, and it's working well. Thanks for the tip!

  • Daniel 29 posts 142 karma points
    Nov 07, 2017 @ 06:36
    Daniel
    2

    Thanks Søren, it worked for me as well.

    I would give a little recap for those that are struggling with making the ModelsBuilder work with Umbraco Cloud and Visual Studio, like me. I tried looking for UmbracoViewPage on Google, but without success. Now that should work with this post.

    In your Web project - not the Core one - you just need to make some changes in the Web.config file:

    1. Make sure ModelsBuilder.Enable is set to true (default): <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    2. Set the Mode to AppData or LiveAppData. This will ensure you can use ModelsBuilder with Visual Studio. The only other way is to use the API mode, but that is a different story. See the above mentioned link for how to do that. So in your Web.config, you should to have: <add key="Umbraco.ModelsBuilder.ModelsMode" value="AppData" />
    3. Then add the key explained in this tread. Create a directory called Models in your App_Code folder in the .Web directory of your site. Then add: <add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/App_Code/Models/" /> to Web.config.

    As said above, this should do the trick! And thanks to Søren for posting this solution in the first place.

Please Sign in or register to post replies

Write your reply to:

Draft