Copied to clipboard

Flag this post as spam?

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


  • Dee 118 posts 338 karma points
    May 18, 2020 @ 10:27
    Dee
    0

    Generated model classes can't find related interfaces

    Hey Guys,

    I am facing some strange issues with my published models by the models builder in my project. builder mode is set to AppData and models are generated. I also included the models folder and the models into the project.

    I ran to this issue, after I could not use the generated models in my razor views, although I was referencing to the Umbraco.Web.PublishedModels as it is set as the namespace for the generated models. Then I took a look at the generated classes and saw that it some model classes do not find the namespaces of the composition document type models:

    enter image description here

    although those classes and interfaces do exist:

    enter image description here

    So I would then expect that building the web project failes due to these errors, but it does not:

    enter image description here

    seems like those model classes are not getting compiled by the solution and getting ignored from the build process.

    I also removed the implementation of the interfaces, to just not having any errors for the post model class for instance, built the application and it is still not available in the razor view:

    enter image description here

    if you have any suggestions, why this is happening, it would be great to share. It's driving me nuts...

    thanks

    dee

  • Joep 96 posts 698 karma points
    May 19, 2020 @ 07:28
    Joep
    0

    Hi,

    Is it giving an error when it is rendering that View? It could just be a Intellisense issue?

    -Joep

  • Dee 118 posts 338 karma points
    May 19, 2020 @ 07:56
    Dee
    100

    I found out that the issue was caused by the visual studio project type which was a web site project. after a painful process i managed to convert the web site project into a web application project in visual studio, and the generated models in the app_data folder are now compiled and working well also in views.

    the model builder appdata mode doesn't work properly in a visual studio web site project.

Please Sign in or register to post replies

Write your reply to:

Draft