Copied to clipboard

Flag this post as spam?

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


  • George Phillipson 108 posts 287 karma points
    Jul 31, 2019 @ 22:58
    George Phillipson
    0

    Errors thrown after upgrade to 8.1.1

    I have upgraded to Umbraco 8.1.1 for the security fix, and now site fails to build with the following error.

    The error is related to the class library which contains the ModelsBuider

    Severity Code Description Project File Line Suppression State Error CS0266 Cannot implicitly convert type 'Umbraco.Core.Models.PublishedContent.IPublishedContentType' to 'Umbraco.Core.Models.PublishedContent.PublishedContentType'. An explicit conversion exists (are you missing a cast?) *\Web.ContentHelper\UmbracoModelBuilder\Blog.generated.cs 34 Active

    Code:

    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.0.4")]
            public new const string ModelTypeAlias = "contact";
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.0.4")]
            public new const PublishedItemType ModelItemType = PublishedItemType.Content;
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.0.4")]
            public new static PublishedContentType GetModelContentType()
                => PublishedModelUtility.GetModelContentType(ModelItemType, ModelTypeAlias);
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.0.4")]
            public static PublishedPropertyType GetModelPropertyType<TValue>(Expression<Func<Contact, TValue>> selector)
                => PublishedModelUtility.GetModelPropertyType(GetModelContentType(), selector);
    #pragma warning restore 0109    
    
  • Nigel Wilson 944 posts 2076 karma points
    Aug 01, 2019 @ 03:37
    Nigel Wilson
    0

    Hi George

    May be off track with this suggestion, but have you tried a "Clean Solution" first ? Primarily trying to delete any previously compiled model records and allow the build to recreate with a clean slate.

    Cheers

    Nigel

  • George Phillipson 108 posts 287 karma points
    Aug 01, 2019 @ 10:36
    George Phillipson
    0

    Hi Nigel

    Done that and it did not work, I have rolled back to the previous state for now and will use the manual fix.

    Regards George

  • George Phillipson 108 posts 287 karma points
    Aug 02, 2019 @ 22:04
    George Phillipson
    0

    If anyone comes across the same issue, this is how I had to fix the problem.

    In previous versions 8.0.2, the modelbuilder created the models with the following code snippet

    public new static PublishedContentType GetModelContentType() public static PublishedPropertyType GetModelPropertyType

    When upgrading to 8.1.1, the above remained the same, thus preventing the solution from building.

    To fix the problem, I had to manually change PublishedContentType and PublishedPropertyType to IPublishedContentType and IPublishedPropertyType

    Once that was done, I was able to rebuild the ModelsBuilder and thus fix the problem.

    Fortunately for me, I only had 20 generated files so it did not take to long.

Please Sign in or register to post replies

Write your reply to:

Draft