248

What is the _references.js file used for in a new ASP.NET MVC 4 project?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Todd Smith
  • 17,084
  • 11
  • 59
  • 78

3 Answers3

268

In VS 11, Visual Studio will give you intellisense from all files that have references in the “_references.js” file.

For More Info (Web Archive backup link)

HotN
  • 4,216
  • 3
  • 40
  • 51
Min Min
  • 6,188
  • 2
  • 19
  • 17
23

MSDN documentation: JavaScript IntelliSense

In brief, _references.js stores the list of JS files paths, for which you want the Visual Studio to gather and build the intelisense (aka "code complete"). The VS project adds there some common JS libraries like jQuery to build the intellisense for it. You can add a reference to your custom JS file in form like this:

/// <reference path="MyScriptFile.js" />
Dmitry Pavlov
  • 30,789
  • 8
  • 97
  • 121
  • 2
    In my experience, usage by Visual Studio (2017) has grown beyond just intellisense. I found that if, for example, `jquery-2.2.2.min.js` was not mentioned in `_references.js`, then it wouldn't get deployed and there would be a run time failure using jquery. – Kit Jul 21 '17 at 09:11
  • ...this may be some kind of interaction with TypeScript and VS's bundler. – Kit Jul 21 '17 at 09:13
11

From Visual Studio 2017 forward, this file is no longer used.

Matthew Peterson
  • 1,055
  • 12
  • 21