Thursday, March 21, 2013

ASP.NET MVC 4: the _references.js file

When creating a new ASP.NET MVC 4 project, I noticed that a  _references.js file was added to the Scripts folder.

If we look at the content, I only see some comments. So what is it good for?

The VS <reference /> Syntax

The // <reference path=”…” /> allows you to enable IntelliSense in any JavaScript file by including everything defined in the JavaScript located at this path.Visual Studio 2012 will give you IntelliSense for all files that have references in the “_references.js” file. This way you can enable IntelliSense for the JavaScript files you use all the time.

If you want, you can add your own files too:

  • Go to Tools –> Options.
  • Browse in the Tree view to Text Editor –> JavaScript –> IntelliSense –> References
  • Here you can add other script files containing reference paths


No comments: