Fixing ASP.NET Core Feature Folders Causing Resharper Intellisense Issues

I’ve had a handful of people ask me about this, so I figured I’d just blog on it.

The Problem

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 like your View() calls in red.

2017-08-24_22-57-12

 

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 Resharper has not added support for Feature Folders to ASP.NET Core yet.

 

The Fix

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*
    https://gist.github.com/scottsauber/58a3fad558c9666b58ef1eabdc8f7936
  3. Re-open your Controller and everything should work

 

  • Note – if you have more custom paths in your IViewLocationExpander than 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!

 

2017-08-24_23-11-51

 

Hope this helps.

 

 

2 thoughts on “Fixing ASP.NET Core Feature Folders Causing Resharper Intellisense Issues

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s