jQuery Intellisense in Visual Studio

·

Upon hearing of Microsoft’s plan of shipping jQuery together with Visual Studio, it became an automatic javascript framework of choice for ASP.Net developers. At least, for me and my team. Recently, they’ve even added Intellisense to Visual Studio (Yes, I’m rather late with the news).

 

I’ve been trying to make it work over the weekend but can’t seem to. Only to find out this one works with Visual Studio 2008 SP1 only.  So, if you’re not yet on SP1 you need to:

 

1.       Download and run this prep tool.

2.       Download and run SP1 installer or ISO

3.       Download this reference file and place in your visual studio project/website. 

 

After this process, you will be able to get Intellisense for your external javascript files by putting the following lines:

 

///<reference path="/pathtojquery/jquery-1.2.6-vsdoc.js"/>

 

Within your .aspx:

 

   <% if (false) {%>

 

    <script src=/pathtojquery/jquery-1.2.6-vsdoc.js" type="text/javascript" />

 

    <% } %>

 

Notice the hack so that it doesn’t get served in production environments. So explains Jeff King in this blog.

 

However, there seems to be no easy way to employ this hack for projects/websites using Master pages. You’d still have to place the above code in each of the child pages for it to work.  Putting on the Master page gives you this error:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

0 comments:

Recent Posts

About Me

Alain Rivas
A software / web developer by profession.
A Born-Again Christian by Faith.
A father of two (with one on the way).
A husband of one.
Once a radio disc jockey for eight years.
Now a geek glued to his computer.
View my complete profile