I found while playing around with Knockout.js, that my Visual Studio Intellisense wasn’t working. This turned out to be because I had formatted my Scripts folder, and moved standard Javascript libraries into another folder.

This meant that Visual Studio couldn’t find my _references.js file.

At first I added the following to the @Scripts Section in my .vbhtml file;


If (False) Then

End If

End Code

Where the If (False) code forces the compiler to ignore the file when publishing.

But this would end up being silly if I had lots of files. So, I had a quick look around and found a couple of useful answers on Stack Overflow;

http://stackoverflow.com/a/12016530/1305169 and

Where, basically, you need to add a reference to your new _references.js file to the Intellisense list options in Visual Studio;

  • In Visual Studio, go to Tools > Options > Text Editor > Javascript > Intellisense > References
  • In the “Add a reference to current group”, type in the relative path to your _references.js file (for me this was “~/Scripts/lib/_references.js”

Hey presto, you should now have working intellisense!

By |2017-07-24T08:33:17+01:00June 26th, 2013|HTML, Javascript, Knockout, Tips, Visual Studio|0 Comments

About the Author:

Leave A Comment