Javascript IntelliSense in Visual Studio

IntelleSense is a pretty standard feature of any modern Integrated Development Environment (IDE). Visual Studio has the ability to display IntelleSense not only for the whole .Net framework but also for any libraries included in the solution and any custom code written in C#, VB or similar language. IntelliSense is not available for javascript files by default, partly because javascript is not build by a compiler. Fortunately it is quite easy to configure.
Firstly, create a new file called _references.js in the ‘Script’ folder of your project (note the intended leading underscore). Then add a reference for each file you require IntelliSense for like below;

/// <reference path="jquery-2.1.1.js" />
/// <reference path="knockout-3.2.0.debug.js" />
/// <reference path="your-custom-file.js" />

There is a shortcut to typing the references manually, simply drag and drop the file from the Solution Explorer into the editor pane and the reference will be added for you.

That’s basically it. Simple but useful.

Switching Microsoft Account User In Visual Studio 2013

A while ago I installed a 30 day trial of VS2013 Premium. At the time I used my personal email to create a Microsoft account and used that to sign in to VS2013. Some time later my MSDN license was renewed and one of the first things I did was to download and install VS2013. The fact there had been a previous installation was recognised and the same Microsoft account was referenced, so when I tried to log in with my normal MSDN Microsoft account VS promptly diaplayed the folling message.

We were unable to establish the connection because it is configured for user but you attempted to connect using user. To connect as a different user perform a switch user operation. To connect with the configured identity just attempt the last operation again.

There have been a few reported method to fix this issue

1. Sign in as a different user:
Click on your name in the upper right corner and click on “Account settings”.
This will give you the option to sign out.
Once signed out you can sign back in as another Microsoft account.

2. Via the registry:
Deleting the following registry key
hkey_current_user\software\Microsoft\VSCommon\12.0\clientservices\tokenstorge\visualstudio\ideuser

In my case I was not able to log in with the old account as between the aforementioned ‘while ago’ and ‘some time later’ I had deleted the Microsoft account referencing my personal email address, it no longer existed. Personally I preferred not to delete registry unless there was no other way. So I ended up using a third option to resolve this by following the suggestion in the VS dialog, and that was to switch user.

3. Switching User:

  1. Exit Visual Studio
  2. Start the Developer Command Prompt for 2013 installed with Visual Studio in the Visual Studio Tools folder. Ensure you right click and select Run as administrator.
  3. At the command prompt type ‘devenv /resetuserdata’
  4. You can now start Visual Studio as Normal.

If you are using the VS2013 Express you will need to replace devenv with the name of the executable. Now when VS2013 opened I was able to sign in with my other Microsoft account.