Copied to clipboard

Flag this post as spam?

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


  • Bora B 27 posts 107 karma points
    18 days ago
    Bora B
    0

    Modelsbuilder with Visual Studio Problem

    Hi,

    I'm using VS 2019 with Umbraco and Models builder enabled. My problem is that, when I create a new document type in Umbraco and try to access a page with that document type I get CS0234: The type or namespace name 'xxxx' does not exist in the namespace 'Umbraco.Web.PublishedModels' (are you missing an assembly reference?)

    to solve this I have to stop visual studio, add the newly generated cs file in models folder to visual studio project and restart debugging. This is very time consuming. I think I'm doing something wrong here. Is there another way?

    the modelsmode is LiveAppData

    Thanks, Bora

  • Patrick van Kemenade 78 posts 272 karma points
    18 days ago
    Patrick van Kemenade
    0

    I had the same question, see here -> https://our.umbraco.com/forum/using-umbraco-and-getting-started/105398-liveappmodel-working-different-then-expected

    I think it worked on the fly in the past but nowadays you have to rebuild the dll containing the published models in LiveAppModel.

    What you still can do on a live website when republicing is not a an option is instead of.

    @Model.AboutText -> this will generate the error if the model dll isn't rebuild in the way you explained

    @Model.Value("AboutText") -> this will work before the model dll is rebuild

    Of course the later isn't a great coding practice so as soon as your able to rebuild and republisch the dll which contains the model also switch back to strongly typed code in the razor view like @Model.AboutText

Please Sign in or register to post replies

Write your reply to:

Draft