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?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
From http://blog.meidianto.com/2010/05/13/vs2010-tips-7-how-to-make-jquery-intellisense-work-for-external-javascript-file/
Drag the jquery file into the js file you want intellisense on like this:
Then it will work like this:
I found good explanation which worked for me at: http://theycallmemrjames.blogspot.com/2011/03/jquery-intellisense-with-aspnet-mvc-and.html
These lines:
should be added to every view (where intellisense is needed). This will enable intellisense but will not add the second reference at runtime.
If that's jQuery specific as the title specifies, trying adding line to the tag in the
Views/Shared/_layout.cshtml
(or.vbhtml
) file: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 (theif
block isn't executed), but doesn't hide it from VS intellisense (and provide another reference usingUrl.Content()
or so to the .min.js file).Seems for me in Vs2012 with a _layout.cshtml that the solution from @Mohamed Meligy doesn't help in views using that layout file. Maybe I'm missing something?
However - the solution here which seems to be recommended approach seems to work a treat and now I have intellisense for all references to all files I add references to in _references.js and don't need the runtime false trick bit, and can keep the views totally clean of references.