_references.js file’s auto sync feature

Xinyang Qiu

In VS2013 RTM, we shipped a not well known feature for _references.js file: /// <autosync enabled="true" />.

If we specify /// <autosync enabled="true" /> 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. You can disable this feature by removing the line or put assign false to enabled attribute.

For example, create a new MVC project, open scripts/_references.js file and you will see the following if you are using VS2013 with update 3.

clip_image001

Drag and drop bootstrap.js file to the Scripts folder to make a copy, and all the missing “.js” files and the newly added “.js” files are automatically referenced in the _references.js file. Note, we ignore the “.min.js” files if the non-minified “.js” file exists.

clip_image003

You can enable and disable the auto sync feature via editor’s context menu button “Auto-sync JavaScript References”. You can always manually update the project’s JavaScript references using the context menu button “Update JavaScript References”.

clip_image004

For more details in _references.js, please visit Mads’ blog The story behind _references.js.

0 comments

Discussion is closed.

Feedback usabilla icon