最近發生 SCSS 無法自動編譯的狀況,查看 Extension and Updates,問題出在 Web Compiler 被停用。

手動重新啟用後一切功能如常,原以為是一時系統秀逗,但接連發生好幾次才感覺不對勁。觀察發現,即時手動啟用,重開 Visual Studio 再開,Web Compiler 又是停用狀態。進一步檢查,則發現另一套件 Bundler & Minifier 也有相同狀況。

爬文找到一篇發生在 Web Essentials 的類似案例,似乎是擴件套件 Cache 錯亂重覆造成的。照著作者做法用 devenv /log 開啟 Visual Studio Log 模式,在 %APPDATA%\Microsoft\VisualStudio\14.0\ActivityLog.xml 記錄中找到一堆 ID 相同導致套件無法載入的錯誤訊息:

2931 ERROR Extension will not be loaded because an extension with the same ID '148ffa77-d70a-407f-892b-9ee542346862' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\1KE1MKUT.YWG\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\AVOVISND.T3V\   Extension Manager 2017/01/01 09:12:06.894
2932 ERROR Extension will not be loaded because an extension with the same ID '148ffa77-d70a-407f-892b-9ee542346862' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\1KE1MKUT.YWG\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\CY10ZHN0.GEN\   Extension Manager 2017/01/01 09:12:06.894
2933 ERROR Extension will not be loaded because an extension with the same ID 'a0ae318b-4f07-4f71-93cb-f21d3f03c6d3' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\01YIXUDP.4S4\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\DGLLFOVT.UKJ\   Extension Manager 2017/01/01 09:12:06.894
2934 ERROR Extension will not be loaded because an extension with the same ID '148ffa77-d70a-407f-892b-9ee542346862' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\1KE1MKUT.YWG\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\LW0SFC1S.34X\   Extension Manager 2017/01/01 09:12:06.894
2935 ERROR Extension will not be loaded because an extension with the same ID 'a0ae318b-4f07-4f71-93cb-f21d3f03c6d3' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\01YIXUDP.4S4\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\NDMEKS5M.CYT\   Extension Manager 2017/01/01 09:12:06.894
2936 ERROR Extension will not be loaded because an extension with the same ID 'a0ae318b-4f07-4f71-93cb-f21d3f03c6d3' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\01YIXUDP.4S4\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\R24FBB2G.B1A\   Extension Manager 2017/01/01 09:12:06.894
2937 ERROR Extension will not be loaded because an extension with the same ID 'a0ae318b-4f07-4f71-93cb-f21d3f03c6d3' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\01YIXUDP.4S4\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\UHHDU3FN.P1K\   Extension Manager 2017/01/01 09:12:06.894
2938 ERROR Extension will not be loaded because an extension with the same ID '148ffa77-d70a-407f-892b-9ee542346862' is already loaded at C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\1KE1MKUT.YWG\...
          C:\USERS\jeffrey\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0\EXTENSIONS\WCSBI30Y.CVD\   Extension Manager

檢查各資料夾內容分別為:

*1KE1MKUT.YWG\ WebCompiler
*01YIXUDP.4S4\ Bundler and Minifier
AVOVISND.T3V\ Bundler and Minifier
CY10ZHN0.GEN\ WebCompiler
DGLLFOVT.UKJ\ Bundler and Minifier
LW0SFC1S.34X\ WebCompiler
NDMEKS5M.CYT\ Bundler and Minifier
R24FBB2G.B1A\ Bundler and Minifier
UHHDU3FN.P1K\ Bundler and Minifier
WCSBI30Y.CVD\ WebCompiler

由此推論我遇到文章所說的狀況-系統存在多個重複的 WebCompiler 與 Bundler and Minifier 資料夾,Visual Studio 啟動時檢查有誤導致擴充套件被強制停用。依照文章裡的做法,連續移除套件直到它從清單消失(在我的案例 Bundler 有六份,Web Compiler 有四份,故連移了十次才移完),再重新安裝一次,問題排除。

後來進一步發現擴件套件資料夾重複應是常見問題,已有善心人士寫好找出重複擴充套件並自動刪除的潛盾機小工具,可以瞬間排除問題,如果懶得反覆手動移除重安裝可考慮使用工具修正問題。


Comments

Be the first to post a comment

Post a comment


46 + 33 =