Copied to clipboard

Flag this post as spam?

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


  • Gary 80 posts 377 karma points
    Jan 10, 2019 @ 13:45
    Gary
    0

    Creating Views in Back Office and Intellisense

    Hi,

    I have a solution within Visual Studio 2017. I can create new files etc and the intellisense works fine as expected. However, if i run the solution and create a new partial view. Opening that new PV in VS then does not allow intellisense on the code apart from the html part of the view, the same happens with Macro Partial Views.

    Can someone help me understand if this is user error or just general expected behavior?

    Thank you :)

    Kind Regards,

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jan 10, 2019 @ 13:49
    Nik
    0

    Hi Gary,

    How is your website set up? Is it a website project in Visual Studio, or a Web Application project in Visual Studio?

    I've found that I have to include the view files into my project, close them and re-open them for Intellisense to kick in properly.

    Nik

  • Gary 80 posts 377 karma points
    Jan 10, 2019 @ 13:55
    Gary
    0

    Hi Nik,

    I created a blank solution with a .NET Application within that solution. I do have to "Show All Files" for the Partial Views and Macro Partial views to be view able.

    Is there a better way to do this?

    Kind Regards,

    Gary Henshall

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jan 10, 2019 @ 14:16
    Nik
    100

    Hi Gary,

    This is normally the approach I use:

    https://our.umbraco.com/documentation/Getting-Started/Setup/Install/install-umbraco-with-nuget

    But, you have to right click on the partials and macro partials and tell them to be included in the project each time they are created (which can be a bit tedious when using this approach).

    Others like to use a WebSite project instead of Web Application project in visual studio because you don't have to add files to the project in the same way.

    Nik

  • Gary 80 posts 377 karma points
    Jan 11, 2019 @ 08:40
    Gary
    0

    Cheers Nik. Including the files to my project worked a treat!

    Thank you :)

  • wgaddis 8 posts 78 karma points
    Jan 10, 2019 @ 21:29
    wgaddis
    0

    I've never had great luck with the Intellisense on razor files. Usually restarting Visual Studio gives it a good enough kickstart to start working again, but it's never consistent.

  • Gary 80 posts 377 karma points
    Jan 11, 2019 @ 08:39
    Gary
    1

    Following Nik's solution of Right Clicking the individual templates and select "Include in Project" worked a treat for me! :)

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jan 11, 2019 @ 08:57
    Nik
    0

    Happy to help :-) Pleased you managed to get it working.

Please Sign in or register to post replies

Write your reply to:

Draft