문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top