ASP.net MVC 3 Razor - jQuery Intellisense

前端 未结 4 1039
有刺的猬
有刺的猬 2021-02-07 11:01

I am using Visual Studio 2010 / ASP.net MVC 3 with the Razor View Engine. I created a new Project with the Internet Application template. What do I need to do to get Intellisens

4条回答
  •  失恋的感觉
    2021-02-07 11:50

    If that's jQuery specific as the title specifies, trying adding line to the tag in the Views/Shared/_layout.cshtml (or .vbhtml) file:

    @if (false) {  }
    

    This will reference the intellisense file to VisualStudio and still will not reference it in runtime.

    Just remember, point to the vsdoc file relatively to the file you put this code in. Any code like ~/Url.Content() or any other runtime code will not be visible to VS for intellisense.
    That's exactly why if (false) hides the script reference from runtime (the if block isn't executed), but doesn't hide it from VS intellisense (and provide another reference using Url.Content() or so to the .min.js file).

提交回复
热议问题