Copied to clipboard

Flag this post as spam?

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


  • Gareth Barnes 3 posts 74 karma points
    Jun 11, 2021 @ 10:39
    Gareth Barnes
    0

    The type or namespace name 'Homepage' does not exist in the namespace 'Umbraco.Web.PublishedModels'

    Hi,

    I'm new to Umbraco and am facing a rather frustrating error. I downloaded the Umbraco 8.14.0 zip file and used Visual Studio 2019 to open it as a website. I was able to start the site up from Visual Studio and set up a custom installation and then followed a tutorial to create new Document Types and corresponding Templates. After a reboot when I try to start the site from Visual Studio now I face the error above with the name "Homepage" being the Document Type and Template I created. I've read a few things online about ModelsBuilder.ModelsMode and have tried setting it to PureLive, Dll, AppData and LiveAppData without any success. I can see in the AppData folder there is a file called models.generated.cs that looks as if it has the definitions for Homepage in it but it looks as if, for some reason, Umbraco is not using this file.

    Thanks in advance for any help.

    Gareth Barnes

  • Marc Goodson 2126 posts 14218 karma points MVP 8x c-trib
    Jun 12, 2021 @ 20:06
    Marc Goodson
    0

    Hi Gareth

    Keep in in AppData mode (or LiveAppData - just means doc type changes automatically regenerate the model classes into the app data folder - just AppData means you have to manually press the 'generate models' button in the developer section of Umbraco)

    Anyway, in this mode to use the models in your Visual Studio solution and get intellisense etc, you need to 'show all files on disk' then you'll see the generated files from within visual studio, but greyed out, then right click them, include in project and rebuild...

    and your ysod should go away!

    regards

    Marc

  • shekhar sharma 22 posts 110 karma points
    Jun 14, 2021 @ 12:33
    shekhar sharma
    0

    Hello Gareth Barnes,

    I Hope you are using default Model Builder in you application which is PureLive. Just Double the check the Builder Builder Configuration in the webConfig File.

    Also Try Below Steps.

    1. Login into the CMS and go to the Setting Tab and Click on the Model-Builder Section on the Right Panel.
    2. Click on the Generate Model Button and than Stop the Application.
    3. Rebuild the Application and start your application again.

    Thanks,

    Shekhar

  • Gareth Barnes 3 posts 74 karma points
    Jun 14, 2021 @ 13:12
    Gareth Barnes
    1

    Hi,

    Thank you both for your responses. Unfortunately no matter what I tried I couldn't get Visual Studio to launch the site (the error happens at compile time so there was no opportunity to do anything through the front end of the CMS). I started again this morning in a new folder with newly extracted files from the zip file and having set the ModelsMode to AppData I followed the tutorial to create a document type and then pressed the Generate Models button and can see a file called HomePage.generated.cs in the AppData | Models folder but once again I am still receiving the same error in Visual Studio when I stop execution and try to restart it even with the HomePage.generated.cs file included in the project.

    I've now followed the instructions to start Visual Studio with a blank project and imported Umbraco from NuGet and have been able to create a new document type, stop the code execution and then restart it successfully so maybe it is a problem with opening the zip file in Visual Studio - I don't think for whatever reason it was going through a full build process.

    Gareth

  • shekhar sharma 22 posts 110 karma points
    Jun 14, 2021 @ 13:20
    shekhar sharma
    0

    Hi Gareth ,

    Have you include the Home.Generated.Cs class In you project ?? If not you have to include the Home.Generated.cs class from Visual Studio and rebuild the application. Check if the error still exists .

    we can have zoom call if you needed.. Thanks

    Thanks,

    Shekhar

  • Gareth Barnes 3 posts 74 karma points
    Jun 14, 2021 @ 13:26
    Gareth Barnes
    0

    Hi,

    Yes, HomePage.generated.cs was included in the project. I'm up and running now by using the NuGet package so am happy to proceed that way and will just ignore the zip file.

    Thanks for your help though.

    Gareth

Please Sign in or register to post replies

Write your reply to:

Draft