Error on generating models in Umbraco 7.6 in ModelsBuilder API mode
I have Umbraco 7.6
I am trying to enable ModelsBuilder in API mode.
As far as I learned in my version of umbraco Umbraco.ModelsBuilder.Api should have already been part of the Umbraco.Core and installed.
However when I check in my Developer > ModelsBuilders tab I can see this:
ModelsBuilder is enabled, with the following configuration:
The models factory is enabled.
The API is enabled but not installed.
External tools such as Visual Studio cannot use the API.
No models mode is specified: models will not be generated.
Models namespace is Umbraco.Web.PublishedContentModels.
Static mixin getters are enabled. The pattern for getters is "Get{0}".
Tracking of out-of-date models is not enabled.
I tried to install Umbraco.ModelsBuilder.Api but have not found any information which ModelsBuilder versions are compatible with Umbraco 7.6 so I installed the latest 8.0.4 into my start Web project.
I installed VS extension and created a separate project to hold models eg. MyProject.Umbraco.Models, right-clicked Builder.cs file and clicked 'Run custom tool' (which I previously set up in the Builder.cs properties.
It does something but at the end it throws an error:
UmbracoModelsBuilder: Starting v8.0.4 10/05/2019 18:29:01.
UmbracoModelsBuilder: UmbracoModelsBuilder failed to generate code: UnsupportedMediaTypeException: No MediaTypeFormatter is available to read an object of type 'IDictionary`2' from content with media type 'text/html'.
UmbracoModelsBuilder: at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
at Umbraco.ModelsBuilder.Api.ApiClient.GetModels(Dictionary`2 ourFiles, String modelsNamespace)
at Umbraco.ModelsBuilder.CustomTool.CustomTool.UmbracoModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)
Version 2.x (and older) are old, obsolete versions of Zbu.ModelsBuilder
Version 3.x is the current version of Umbraco.ModelsBuilder for Umbraco 7
Version 8.x is the current version of Umbraco.ModelsBuilder for Umbraco 8
Error on generating models in Umbraco 7.6 in ModelsBuilder API mode
I have Umbraco 7.6
I am trying to enable
ModelsBuilder
in API mode. As far as I learned in my version of umbracoUmbraco.ModelsBuilder.Api
should have already been part of theUmbraco.Core
and installed.However when I check in my Developer > ModelsBuilders tab I can see this:
In my
web.config
I have this:Since it says:
I tried to install
Umbraco.ModelsBuilder.Api
but have not found any information whichModelsBuilder
versions are compatible with Umbraco 7.6 so I installed the latest 8.0.4 into my start Web project.I installed VS extension and created a separate project to hold models eg.
MyProject.Umbraco.Models
, right-clickedBuilder.cs
file and clicked 'Run custom tool' (which I previously set up in theBuilder.cs
properties.It does something but at the end it throws an error:
Anyone can help with this?
Versions
Several version of Models Builder have existed:
Version 2.x (and older) are old, obsolete versions of Zbu.ModelsBuilder Version 3.x is the current version of Umbraco.ModelsBuilder for Umbraco 7 Version 8.x is the current version of Umbraco.ModelsBuilder for Umbraco 8
Borrowed from the readme on https://github.com/zpqrtbnk/Zbu.ModelsBuilder
is working on a reply...