Javascript Intellisense in Razor, JScript files in Visual Studio 2010

Quick note to self. To reference a javascript vsdoc for intellisense in VS2010…

In Razor files (.cshtml) use the following construct (note that the condition is evaulated at runtime only):

@if (false)
{
    <script src="/Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
}

In JScript (.js) files a file path is required rather than a Url. The easiest way to get this right is to “drag” the target .vsdoc file using the solution explorer to the open document of the file requiring the reference.

/// <reference path="../jquery-1.4.1-vsdoc.js" />
function calculateBalances() {
   .....
}
Advertisements
This entry was posted in Javascript, Visual Studio and tagged . Bookmark the permalink.

One Response to Javascript Intellisense in Razor, JScript files in Visual Studio 2010

  1. jafbueno says:

    Man, you’ve saved my day!
    I looking for something like that for hoours…
    I know, I’m a YEAR late, but still help me a lot!

    Thank you so much for sharing with the community!
    (If you have something more recent about this issue, I really want to know about)

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