Copied to clipboard

Flag this post as spam?

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


  • bh 408 posts 1395 karma points
    Nov 08, 2018 @ 13:36
    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 212 posts 604 karma points
    Nov 08, 2018 @ 14:19
    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 408 posts 1395 karma points
    Nov 08, 2018 @ 14:49
    bh
    0

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

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Nov 08, 2018 @ 15:54
    Alex Skrypnyk
    0

    Hi BH

    Do you use web application project or website?

    All needed dlls are in bin folder?

    Alex

  • bh 408 posts 1395 karma points
    Nov 08, 2018 @ 16:01
    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 6132 posts 23951 karma points MVP 7x admin c-trib
    Nov 08, 2018 @ 15:55
    Alex Skrypnyk
    0

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

  • bh 408 posts 1395 karma points
    Nov 08, 2018 @ 16:03
    bh
    0

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

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Nov 08, 2018 @ 16:16
    Damiaan
    0

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

    enter image description here

  • bh 408 posts 1395 karma points
    Nov 08, 2018 @ 16:22
    bh
    0

    Not sure. enter image description here

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Nov 08, 2018 @ 16:24
    Damiaan
    0

    This is not right I think. What kind of project have you? Sure this is a .net framework web application?

  • Harry Spyrou 212 posts 604 karma points
    Nov 08, 2018 @ 17:56
    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 408 posts 1395 karma points
    Nov 08, 2018 @ 18:05
    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 212 posts 604 karma points
    Nov 08, 2018 @ 18:07
    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 408 posts 1395 karma points
    Nov 08, 2018 @ 18:14
    bh
    0

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

  • Harry Spyrou 212 posts 604 karma points
    Nov 08, 2018 @ 18:23
    Harry Spyrou
    100

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

  • bh 408 posts 1395 karma points
    Nov 08, 2018 @ 18:35
    bh
    0

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

  • Harry Spyrou 212 posts 604 karma points
    Nov 08, 2018 @ 18:51
    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 408 posts 1395 karma points
    Nov 08, 2018 @ 18:56
    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