Updated: 2020-05-03. Thanks to Luke in the comments for his tip about Partial Views.
I’ve had a handful of people ask me about this, so I figured I’d just blog on it.
If you use Feature Folders in ASP.NET Core you may see something like this where Resharper can’t figure out where your Views are. It will outline your View() calls in red (as well as your partials).
When you run the app it still works, but it leaves a little to be desired with the Developer experience. Feature Folders are supported in Resharper and plain ASP.NET, but in ASP.NET Core Resharper has not added support for Feature Folders yet.
Luckily, there’s a workaround, that I was first notified of by Bill Sorensen on my blog post on Feature Folders linked above.
1. Install the JetBrains.Annotations NuGet package
2. Add the following attributes to the top of your IViewLocationExpander file, above the namespace*
3. Re-open your Controller and everything should work
- Note – if you have more custom paths in your
IViewLocationExpanderthan just those, then you’ll have to add those routes as well.
So your final output should look something like this:
That’s it, now Resharper is happy!
Hope this helps.