Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net MVC 3 Razor - jQuery Intellisense

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 Intellisense working?

like image 914
Dismissile Avatar asked Mar 02 '11 22:03

Dismissile


1 Answers

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) { <script src="../../Scripts/jquery-1.4.4-vsdoc.js" type="text/javascript"></script> }

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).

like image 55
Meligy Avatar answered Oct 12 '22 02:10

Meligy