Copied to clipboard

Flag this post as spam?

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


  • Mats Lidström 3 posts 93 karma points
    25 days ago
    Mats Lidström
    0

    The type or namespace name 'Home' could not be found

    I just installed a fresh Umbraco with the Clean starter kit and I get this in the error list. It's at line 4 in mainNavigation.cshtml.

    var homePage = Model.AncestorOrSelf<Home>();
    

    Despite these errors the site compiles and runs so it's only the editor that can't find it. The compiler is fine.

    Anyone got a solution to this?

  • Shaishav Karnani from digitallymedia.com 270 posts 1195 karma points
    24 days ago
    Shaishav Karnani from digitallymedia.com
    0

    Hi Mats,

    It seems your ModelBuilder has not generated the Model. So, it is not able to get Home class.

    Under Settings Section -> Model Builder Tab will show Model Builder is enabled and where Model files have been created.

    Please can you check and confirm.

    Regards,

    Shaishav

  • Mats Lidström 3 posts 93 karma points
    23 days ago
    Mats Lidström
    0

    Yes, Models Builder is enabled and running Pure Live. The files are there in App_Data/Models

    I found on this page https://our.umbraco.com/documentation/reference/routing/custom-controllers that if you use Models Builder you can use @inherits Umbraco.Web.Mvc.UmbracoViewPage<HomePage> but that doesn't work for me. I get the red "wiggly line" under HomePage on that line. The type or namespace could not be found.

    Could you give me some code that you know should work so I can do more tests?

  • Mats Lidström 3 posts 93 karma points
    23 days ago
    Mats Lidström
    100

    Ok I found the solution:

    If you want Visual Studio to know about your models, they do need to exist in a proper DLL so the correct solution is indeed to go for value="Dll" and generate the DLL.

    I think that would be one of the first lines in the tutorial :D

  • Biagio Paruolo 1472 posts 1611 karma points c-trib
    6 days ago
    Biagio Paruolo
    0

    Strange. I've similar problem on a fresh and clean Umbraco 8.1.4 installation with Umbraco Starter kit, Bulma Starter kit and another one. Do it possible that they don't test on Umbraco 8.1.4?

Please Sign in or register to post replies

Write your reply to:

Draft