Copied to clipboard

Flag this post as spam?

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

  • Chris 32 posts 108 karma points
    Oct 07, 2021 @ 09:08

    Umbraco v9 - Unable to publish due to missing namespace in Umbraco.Cms.Web.Common.PublishedModels


    Just trying to publish our first site in v9. Getting the following error

    The type or namespace name 'AboutDT' does not exist in the namespace 'Umbraco.Cms.Web.Common.PublishedModels' (are you missing an assembly reference?)

    Have the templates set up as

    @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.AboutDT>

    Works locally using InMemoryAuto but fails on publish. I have tried the different ModelsBuilder ModelsMode in the appsettings.json but both SourceCodeManual and SourceCodeAuto now fail to build locally with the same "namespace does not exist" error so not generating any models in "umbraco/models" folder

    What am I doing wrong? Thanks.

  • Chris 32 posts 108 karma points
    Oct 19, 2021 @ 12:35

    Anyone please?

    This is what the Models builder tab says

    enter image description here


  • Warren Buckley 2106 posts 4825 karma points MVP ∞ admin hq c-trib
    Oct 19, 2021 @ 13:00
    Warren Buckley

    Hi Chris 👋

    I would suggest SourceCodeAuto or SourceCodeManual ModelsBuilder mode.

    This will then allow you to generate C# Models on disk that can be part of the build compilation.

    With the setting changed to SourceCodeAuto anytime a new property is added or a document type is changed then it will generate the C# models for you.

    If you prefer the Manual mode then you will need to visit the dashboard in the backoffice and click the button to generate them.

    If you are to do this on your local development machine for this setting, then you can version control the C# Models and when doing a dotnet publish or deployment to your live site the C# models will be part of the build and should not give you this error you are seeing.

    Warren 😃

  • Chris 32 posts 108 karma points
    Oct 19, 2021 @ 13:24

    Hi Warren,

    Thanks for the pointers.

    Got it working with SourceCodeManual by going directly to /umbraco#/settings?dashboard=settingsModelsBuilder, clicking 'Generate models' and then restarting the project to pick up the .generated.cs models in the /umbraco/models folder.

    It appears you still have to do that with the Auto option too but I presume once generated it keeps the models upto date, as you say, although I thought it would have also auto generate the models for you on start on the first time too.

    Got it published so that is great. Thanks.

  • Ayod El Modai Arune 1 post 71 karma points
    Dec 01, 2021 @ 19:25
    Ayod El Modai Arune


    I can't find Generate models button on this pathenter image description here

  • Chris Clancy 56 posts 123 karma points
    Feb 21, 2022 @ 13:47
    Chris Clancy


    In appsettings.json, make sure modelsbuilder included.

    "Umbraco": {
    "CMS": {
      "Hosting": {
        "Debug": false
      "ModelsBuilder": {
        "ModelsMode": "SourceCodeManual"


  • Warren Buckley 2106 posts 4825 karma points MVP ∞ admin hq c-trib
    Oct 19, 2021 @ 13:29
    Warren Buckley

    Glad you got it resolved then :)

Please Sign in or register to post replies

Write your reply to: