Getting SharePoint 2010 JavaScript Intellisense to Work in VS2010

I’ve been struggling with getting JavaScript Intellisense to work on and off over the last few months. I keep trying, finding it not working, so I go and do something else instead.  But I’m involved in a small project right now in which I was determined to get it working and finally, I have found a reliable way to do just that, thanks to this very useful link on The Code Project.

So most blogs say just to add in a JavaScript comment/reference like below (The C:\14 directory is a symbolic link to the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14 folder created using the standard windows mklink command line – thanks to Chakkaradeep Chandran for this nugget) :

imageIntellisense NOT working despite the reference comments!

This should  work but never has for me, as can be seen in the image, I should be getting suggestions relating to UI, Dialog etc, but nothing is apparent.  What I needed and was pointed out in The Code Project article is that there is an additional reference required here to MicrosoftAjax.js.  Where the heck is this located? Well it’s actually an embedded reference in the System.Web.Extensions DLL, which is part of the .NET Framework 3.5. 

imageLocating the origin of MicrosoftAjax.js

So by adding in an additional reference comment so:

/// <reference name="MicrosoftAjax.js" />

(Note the attribute ‘name’ not ‘path’!) then pressing Cntl + Shift + J which updates the JavaScript Intellisense in VS2010 and trying again, suddenly the wonderful Javascript Intellisense clicked in and I saw this:

imageIntellisense WORKING with the additional reference comment!

About time too!  There is one downside and that is it only works when the JavaScript file is in the root of the project, a little annoying, but not the end of the world.  It’s only taken me several months to get to this stage.  So I hope this helps someone, somewhere with this issue.

Cheers

Dave Mc

Advertisements

About davemcmahon81
Software Developer & Architect, User Group Leader, Speaker, Writer, Blogger, Occasional Guitarist, Man-made Global Warming Sceptic, Climate Change Believer, General Optimist but most of all proud Husband and Dad ...

2 Responses to Getting SharePoint 2010 JavaScript Intellisense to Work in VS2010

  1. Pingback: SharePoint 2010: Recopilatorio de enlaces interesantes (XV)! « Pasión por la tecnología…

  2. Pingback: Blog del CIIN

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: