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?
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.
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
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
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:
Use the plugin - It has a community team supporting it - https://twitter.com/UModelsBuilder
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 toNothing
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
Thank you very much for you reply and this overview. Extremely useful ;-)
is working on a reply...