_references.js file – The Ultimate Flashback

Visual Studio 2013 RTM was shipped with a feature – /// <autosync enabled=”true” /> for _references.js file.

If you specify the above code in the beginning of ~/scripts/_references.js, then any addition, rename, deletion of JavaScript files in the project will automatically change the content in this file. It is also possible to disable this feature by providing a code like /// <autosync enabled=”false” />

In order to work with the feature, you need to create a new MVP project and open scripts/_references.js file. You will view a screenshot as shown below

Visual Studio 2013 RTM

You can drag and drop bootstrap.js file to the Scripts folder to make a copy. You will be able to see that all the missing “.js” files and the newly added “.js” files are automatically referenced in the _references.js file.

Visual Studio 2013 RTM

Mads Kristensen has published a detailed blog post which examines the complete story behind _references.js.

You can easily activate the auto sync feature via editor’s context menu button “Auto-sync JavaScript References”. Moreover, you can manually update the project’s JavaScript references using the context menu button “Update JavaScript References”.

Visual Studio 2013 RTM

“The _references.js file controls a key part of the JavaScript Intellisense in Visual Studio for web projects and can mean the difference between awesome Intellisense and none at all”. said Kristensen.

Leave a Comment