Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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 :)
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.
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?
This is normally the approach I use:
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.
Cheers Nik. Including the files to my project worked a treat!
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.
Following Nik's solution of Right Clicking the individual templates and select "Include in Project" worked a treat for me! :)
Happy to help :-) Pleased you managed to get it working.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted