Copied to clipboard

Flag this post as spam?

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

  • James Inger 8 posts 99 karma points
    1 week ago
    James Inger

    Model Builder not working

    HI ALl,

    I created a document type and then generated the Models (dll mode).

    I then altered the locked name of the document and generated the models again.

    Now there is always an error, and cannot create any more document types.

    Error as below for Model Builder

    Failed to build models.
    } expected
    at Umbraco.ModelsBuilder.Building.Compiler.ThrowExceptionFromDiagnostic(String path, String code, Diagnostic diagnostic)
    at Umbraco.ModelsBuilder.Building.Compiler.<>c__DisplayClass12_0.<GetCompilation>b__0(KeyValuePair`2 x)
    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
    at Umbraco.ModelsBuilder.Building.Compiler.GetCompilation(StringassemblyName, IDictionary`2 files, SyntaxTree[]& trees)
    at Umbraco.ModelsBuilder.Building.CodeParser.Parse(IDictionary`2 files, IEnumerable`1 references)
    at Umbraco.ModelsBuilder.Umbraco.ModelsBuilderBackOfficeController.GenerateModels(String modelsDirectory, String bin)
    at Umbraco.ModelsBuilder.Umbraco.ModelsBuilderBackOfficeController.BuildModels()

    Any help would be awesome

    What file do I have to edit to fix the problem ??

    Is there anyway to manually generate the Models ???

  • Nik 869 posts 3467 karma points MVP c-trib
    1 week ago

    Hi James,

    This is one of those unhelpful error messages but I think the issue is the version of C# models builder is trying to use.

    If you add this to your App Settings in web.config it might resolve the issue:

    <add key="Umbraco.ModelsBuilder.LanguageVersion" value="CSharp6" />


  • James Inger 8 posts 99 karma points
    1 week ago
    James Inger

    Thanks for that - But that did not work

    I also have an error as below

    public class _Page_Views_MainPage_cshtml : Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.MainPage> {

    Is there a way to fix this manually ??

  • MuirisOG 318 posts 1070 karma points
    1 week ago

    What new name have you given the document type?

    I believe the underscore character may cause problems.

Please Sign in or register to post replies

Write your reply to: