Javascript Intellisense in Visual Studio 2012

After years of use, I tend to accumulate a lot of cruft on my work computer hard drives, so whenever I replace a machine or hard drive I like to start fresh and only pull down old files from the backup server as I need them.  Last week, I replaced the hard drive on my laptop, so I had to redo all of the settings on Visual Studio.  As I had forgotten how to do this, I figured I should write it down to help me next time… perhaps it will help you too?

When developing Visual Studio MVC projects, if you’re like me, you like to move directories around to make more sense of the layout (instead of the default structure that M$ gives you).  An example of this is creating a public directory to hold your publicly available files, like styesheets and scripts.  You’ll also notice that when you move your Javascript libraries, Intellisense breaks.  This happens whenever the _references.js file is moved from its expected location*.

To fix, simply go to Tools | Options | Text Editor | JavaScript | IntelliSense References.  Switch to the Implicit (Web) Reference Group and add a new reference that resolves to the new location of the _references.js file:


Note that if you want to use a path relative to your project, it has to be entered into the text box at the bottom, in the form of “~/whatever_dirs_below_project_root”.

* If you want Intellisense support for your Javascript libraries, you need to be sure that the library name is included in the _references.js file.  This is not all, however.  VS also needs a vsdoc.js file that provides the particular data needed by Visual Studio Intellisense (e.g. jquery-1.10.0-vsdoc.js supports jquery-1.10.0.js).  Note that you should NOT include the vsdoc file name in the _references.js file, just the main file.  Intellisense vsdoc files for jquery are available on the ASP.NET CDN at


Leave a Reply

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

You are commenting using your 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: