Copied to clipboard

Flag this post as spam?

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


  • Emmanuelle Philippe 10 posts 51 karma points
    Jun 11, 2020 @ 10:11
    Emmanuelle Philippe
    0

    Developing on v8.6 with Visual Studio: just for Cloud?

    Hi folks

    Installed via NuGet on Visual Sutdio 2019 yesterday for a client project but when switching the ModelBuilder to LiveDll as I used to on earlier v8, I got a compilation error telling me that this no longer was a valid mode.

    Looking this up, I came across info about a full ModelBuilder plugin but that seemed to be for Umbraco.Cloud, which we are not using.

    Does this me that I can no longer use to VS to work on locally hosted version of Umbraco?

    Thanks in advance for your help

  • Matthew Wise 271 posts 1373 karma points MVP 4x c-trib
    Jun 11, 2020 @ 11:16
    Matthew Wise
    100

    Hi David,

    The models builder plugin was originally shipped with Umbraco, as of 8.5 it now ships its own version which does not have all the features of the plugin.

    You have a couple of options:

    1. Use the plugin - It has a community team supporting it - https://twitter.com/UModelsBuilder

    2. If you don't want to use the plugin (I do it this way) I would suggest doing the flowing:

    Use Umbraco.ModelsBuilder.ModelsMode="LiveAppData" when you want to generate models when you are running on an environment that shouldn't set this to Nothing

    This setting creates *doctypealias*.generated.cs files in your App_Data folder and be compiled at runtime, which means no intellisense and some startup time.

    To fix those issues create a .netstandard class library for holding your Models and/or c# code. Make sure to edit the csproj file replacing the targetFrameworks with <TargetFrameworks>net472</TargetFrameworks> This will function as a normal class library but will automatically include files and has a better dependency view in VS.

    To move the generated files into the new project you will need to set the follow

    Umbraco.ModelsBuilder.AcceptUnsafeModelsDirectory="true"

    Umbraco.ModelsBuilder.ModelsDirectory="../../<path to the folder you want them in"

    On an environment you are not generating models remove these two settings via transforms.

    I hope this helps

    Matt

    EDIT full details of these settings can be found here

  • Emmanuelle Philippe 10 posts 51 karma points
    Jun 12, 2020 @ 09:51
    Emmanuelle Philippe
    0

    Thank you very much for you reply and this overview. Extremely useful ;-)

Please Sign in or register to post replies

Write your reply to:

Draft