Does Intellisense CDN use jQuery?

I read in "jQuery for ASP.NET Developers" this re: getting Intellisense support in VS for jQuery: ".... VSDoc file for jQuery ... VSDoc file ... uses the same name as your JavaScript file with -vsdoc inserted before the .js extension. For example, if my jQuery file is called jQuery-1.3.2.js, then the vsdoc file will be called jQuery-1.3.2-vsdocjs. The VSDoc file must exist in the same directory as your file jQuery so VS can find it. "

Does this mean that using CDN for jQuery files prevents Intellisense from working?

+4
source share
1 answer

You can use CDN and have Intellisense support in Visual Studio. There are two ways to do this:

  • Add the Intellisense link to the *vsdoc.js file, which is located on the CDN. Go to Tools | Options Tools | Options :

    Options dialog

    Note that you will need to record for each *vsdoc.js you want to use.

  • If you know that the *vsdoc.js file is in the same directory as the js file on the CDN (for example, on ASP.NET CDN) and you are using MVC, you can simply update your _references.js file to reflect this:

/// <reference path="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.0.js" />

If you need help with _references.js, see my blog post here .

Be sure to update the link to your web page (or _Layout.cshtml) to actually use the CDN. Please note that the js path you use for your web pages does not have to match your Intellisense link (of course, you obviously want them to be the same version)!

 <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> </head> <body> <div id="body"> @RenderBody() </div> <script src="@Url.Content("http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js")" type="text/javascript"></script> @RenderSection("scripts") </body> </html> 

NOTE. The above examples assume that you are not using ASP.NET 4.5 binding or using CDN features such as path mirroring and reverse proxies. I assume that if you use these functions, you know what needs to be done to make them work.

+5
source

Source: https://habr.com/ru/post/1486274/


All Articles