Domanda

Resharper auto-completes/hints and verifies file paths when I am in a Razor template and type an image tag's src attribute. However, throughout my ASP.net application I have many methods that take a String that represents a path to a file. Is there any way that I can enable this same verification and auto-completion functionality for those strings?

file path help in Resharper

I am using VS 2013, Resharper 8.1, along with ASP.net MVC, and Web Essentials.

È stato utile?

Soluzione

What you're asking can be solved by applying ReSharper's Code Annotations to your helpers! I recently recorded a webinar with JetBrains called ReSharper Secrets, where I talk in depth about Annotations, and actually show how to do the very thing you're asking! (around 32 minutes in)

Basically, you need to apply the [PathReference] attribute on the string parameter of your helper methods that represents the path, and you're done! I wrote a blog post about how to do it, you can read it here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top