{"id":174,"date":"2014-10-10T10:00:00","date_gmt":"2014-10-10T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2014\/10\/10\/_references-js-files-auto-sync-feature\/"},"modified":"2022-08-08T03:45:04","modified_gmt":"2022-08-08T10:45:04","slug":"_references-js-files-auto-sync-feature","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/_references-js-files-auto-sync-feature\/","title":{"rendered":"_references.js file\u2019s auto sync feature"},"content":{"rendered":"<p>In VS2013 RTM, we shipped a not well known feature for _references.js file: \/\/\/ &lt;autosync enabled=&quot;true&quot; \/&gt;. <\/p>\n<p>If we specify \/\/\/ &lt;autosync enabled=&quot;true&quot; \/&gt; 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.<\/p>\n<p>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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2014\/10\/1538.clip_image001_thumb_6EE9AE47.png\"><img decoding=\"async\" title=\"clip_image001\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2014\/10\/1538.clip_image001_thumb_6EE9AE47.png\" width=\"811\" height=\"396\" \/><\/a><\/p>\n<p>Drag and drop bootstrap.js file to the Scripts folder to make a copy, and all the missing \u201c.js\u201d files and the newly added \u201c.js\u201d files are automatically referenced in the _references.js file. Note, we ignore the \u201c.min.js\u201d files if the non-minified \u201c.js\u201d file exists.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2014\/10\/3617.clip_image003_thumb_4A559012.jpg\"><img decoding=\"async\" title=\"clip_image003\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image003\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2014\/10\/3617.clip_image003_thumb_4A559012.jpg\" width=\"628\" height=\"322\" \/><\/a><\/p>\n<p>You can enable and disable the auto sync feature via editor\u2019s context menu button \u201cAuto-sync JavaScript References\u201d. You can always manually update the project\u2019s JavaScript references using the context menu button \u201cUpdate JavaScript References\u201d.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2014\/10\/3225.clip_image004_thumb_56578046.png\"><img decoding=\"async\" title=\"clip_image004\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image004\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2014\/10\/3225.clip_image004_thumb_56578046.png\" width=\"455\" height=\"440\" \/><\/a><\/p>\n<p>For more details in _references.js, please visit Mads\u2019 blog <a href=\"http:\/\/madskristensen.net\/post\/the-story-behind-_referencesjs\">The story behind _references.js<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In VS2013 RTM, we shipped a not well known feature for _references.js file: \/\/\/ &lt;autosync enabled=&quot;true&quot; \/&gt;. If we specify \/\/\/ &lt;autosync enabled=&quot;true&quot; \/&gt; 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 [&hellip;]<\/p>\n","protected":false},"author":410,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7372,7364,7436],"class_list":["post-174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-javascript","tag-references","tag-visual-studio-2013"],"acf":[],"blog_post_summary":"<p>In VS2013 RTM, we shipped a not well known feature for _references.js file: \/\/\/ &lt;autosync enabled=&quot;true&quot; \/&gt;. If we specify \/\/\/ &lt;autosync enabled=&quot;true&quot; \/&gt; 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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/410"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}