Copied to clipboard

Flag this post as spam?

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


  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Feb 01, 2018 @ 10:42
    Ravi Motha
    0

    ModelsBuilder Failed to generat emodels for some reason

    I'm getting the following error in with Models Builder..

      Failed to build models.
    Feature 'auto property initializer' is not available in C# 5. Please use language version 6 or greater.
    
    at Umbraco.ModelsBuilder.Building.Compiler.ThrowExceptionFromDiagnostic(String path, String code, Diagnostic diagnostic) in X:\Projects\Umbraco\ModelsBuilder\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 161
    at Umbraco.ModelsBuilder.Building.Compiler.<>c__DisplayClass12_0.<GetCompilation>b__0(KeyValuePair`2 x) in X:\Projects\Umbraco\ModelsBuilder\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 50
    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(String assemblyName, IDictionary`2 files, SyntaxTree[]& trees) in X:\Projects\Umbraco\ModelsBuilder\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 46
    at Umbraco.ModelsBuilder.Building.CodeParser.Parse(IDictionary`2 files, IEnumerable`1 references) in X:\Projects\Umbraco\ModelsBuilder\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\CodeParser.cs:line 38
    at Umbraco.ModelsBuilder.Umbraco.ModelsBuilderBackOfficeController.GenerateModels(String modelsDirectory, String bin) in X:\Projects\Umbraco\ModelsBuilder\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Umbraco\ModelsBuilderBackOfficeController.cs:line 108
    at Umbraco.ModelsBuilder.Umbraco.ModelsBuilderBackOfficeController.BuildModels() in X:\Projects\Umbraco\ModelsBuilder\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Umbraco\ModelsBuilderBackOfficeController.cs:line 35
    

    I've been trying to revert the chnages i mage to the doctypes but is there an easy way to get this fixed or help me diagnose my issue

  • Steven Harland 78 posts 518 karma points c-trib
    Feb 01, 2018 @ 10:58
    Steven Harland
    100

    As discussed on Slack if you want to use C# 6 features in your extended models then you need to enable it in the config. See this post for details: https://our.umbraco.org/forum/templates-partial-views-and-macros/83962-modelsbuilder-not-working-with-c6-code

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Feb 01, 2018 @ 10:59
    Ravi Motha
    1

    I must have slipped a teeny bit of c6 in , because : i impleneted this fix

    https://our.umbraco.org/forum/templates-partial-views-and-macros/83962-modelsbuilder-not-working-with-c6-code

    and I got my solution working.. check your code check your head, and Thanks to Nik Rimington and Steven Harland for the link and fix high five you rock gents

Please Sign in or register to post replies

Write your reply to:

Draft