Copied to clipboard

Flag this post as spam?

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


  • William Even 13 posts 111 karma points
    1 week ago
    William Even
    0

    Visual Studio 2019 Frustrations

    I am attempting to work with templates in Visual Studio 2019 after creation in the Umbraco Back Office (using Umbraco V.8.3).

    Whenever I create a new document type and attempto open the associated template/view in Visual Studio, I instantly receive an error stating that the

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

    I thought I was able to use VS, but it appears I cannot (?).

    Am I missing something?

    Thank you, Bill Even CTG

  • Amir Khan 995 posts 2013 karma points
    1 week ago
    Amir Khan
    100

    Might need to switch your Models Builder Mode: https://our.umbraco.com/documentation/reference/templating/modelsbuilder/

  • Nik 1154 posts 4742 karma points MVP 2x c-trib
    1 week ago
    Nik
    0

    Hey Bill,

    The error you are seeing is misleading I believe. I'm making an assumption that you are using a default installation of Umbraco here.

    By default, Umbraco runs with models in Pure Live mode. What this means is that the class models don't really exist until runtime. The templates that are created by Umbraco have code to access the model, however because they don't quite exist yet visual studio, in particular, the intelisese and the compiler don't know about the classes. This is why "errors" are shown. The reason they are false errors is because the views aren't evaluated untill runtime and by this point the pure live models have been generated and so no error actually exists.

    If you want to have intelisese pick up the models you'll need to change the models builder mode.

    Nik

  • William Even 13 posts 111 karma points
    5 days ago
    William Even
    0

    Amir and Nik both had the right idea, but Nik provided a little more detail. I marked you both as solution givers.

    Thank you.

    Bill

  • Amir Khan 995 posts 2013 karma points
    5 days ago
    Amir Khan
    0

    Thanks Bill, glad you sorted it out. Amazing how those types of things can be so frustrating the first time you encounter them.

Please Sign in or register to post replies

Write your reply to:

Draft