Copied to clipboard

Flag this post as spam?

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


  • bh 121 posts 400 karma points
    7 days ago
    bh
    0

    Umbraco *.cshtml in Visual Studio

    In my VS 2017 templates using @inherits Umbraco.Web.Mvc.UmbracoTemplatePage aren't doing intelisense or contextual formatting. But, on my @inherits Umbraco.Web.Mvc.UmbracoViewPage<IEnumerable<IPublishedContent>> it is doing both intelisense and contextual formatting. I just updated my VS 2017. Any ideas?

  • Harry Spyrou 138 posts 398 karma points
    7 days ago
    Harry Spyrou
    0

    How about UmbracoViewPage instead of UmbracoTemplatePage? In general as far as I know is to stop using UmbracoTemplatePage and use UmbravoViewPage

  • bh 121 posts 400 karma points
    7 days ago
    bh
    0

    Changed it to UmbracoViewPage and still no intelisense or contextual formatting.

  • Alex Skrypnyk 4816 posts 17299 karma points MVP 2x admin c-trib
    6 days ago
    Alex Skrypnyk
    0

    Hi BH

    Do you use web application project or website?

    All needed dlls are in bin folder?

    Alex

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    I started with an empty web application.

    I followed this guide when I started my project https://our.umbraco.com/documentation/getting-started/setup/install/install-umbraco-with-nuget

  • Alex Skrypnyk 4816 posts 17299 karma points MVP 2x admin c-trib
    6 days ago
    Alex Skrypnyk
    0

    If you use web application - views should be included into project

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    The views are in my solution explorer in VS, just not getting the intelisense or contextual formatting on the viewpage.

  • Damiaan 411 posts 1175 karma points MVP c-trib
    6 days ago
    Damiaan
    0

    Is, in the properties window, the build action "Content"?

    enter image description here

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    Not sure. enter image description here

  • Harry Spyrou 138 posts 398 karma points
    6 days ago
    Harry Spyrou
    0

    Hi bh,

    Can you show me the view in VS?

    Like this:

    enter image description here

    ProductPage in my case is included in the project and gives intellisense. SearchResults is not and doesn't.

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    Home.cshtml has the option to "include in project" when I right-click in solution explorer. Ergo it must not be included. Home does not show intelisense or contextual formatting.

    ncNewsPerspectiveGrid.cshtml also has the "include in project" option when I right-click in solution explorer. ncNewsPerspectiveGrid does show intelisense and contextual formatting.

    enter image description here

  • Harry Spyrou 138 posts 398 karma points
    6 days ago
    Harry Spyrou
    0

    That's the problem. It doesn't go for everything, but only views included in the project are actually part of the application (if I can say it like this). That's your problem. Always include your views.

    Once you do, your intellisense will come up because then VS knows (oh shit those assemblies/namespaces whatever can be referenced here).

    Cheers dude.

    Edit: Nothing that is excluded from the project will be included when you hit 'Publish' in VS and select configuration mode as 'release'. That goes for Models, Controllers etc etc

    TL;DR your clients are going to be very angry that they have a broken project.

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    Including the file in the project did not rectify the intelisense and contextual formatting issue.

  • Harry Spyrou 138 posts 398 karma points
    6 days ago
    Harry Spyrou
    100

    Try restarting VS. Is what you're trying to use also included? As in, your models etc?

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    BOOYAH! Thank you @HarrySpyrou ! I included EVERYTHING in my project, and restarted VS, and it's working. Thank you sir!

  • Harry Spyrou 138 posts 398 karma points
    6 days ago
    Harry Spyrou
    0

    Glad I could help man. Be careful with including everything as whatever you include in the project (Models, Controllers etc) will be compiled to dlls and that could cause problems with bigger projects. A happy medium is to include only the things that you need

    Cheers.

  • bh 121 posts 400 karma points
    6 days ago
    bh
    0

    Thanks for the heads-up. I had to exclude the Obj/Debug and Models folders to get the project to build.

Please Sign in or register to post replies

Write your reply to:

Draft