1. 程式人生 > >解決VS2017啟動失敗,提示Access Denied Error的問題

解決VS2017啟動失敗,提示Access Denied Error的問題

之前因為要用.NET Core相關的預研,裝上了vs2017社群版。
最近在做編碼規範支援的時候,安裝完EditorConfig Language Service外掛後,發現vs打不開了,提示Access Denied Error,在ActivityLog.xml的啟動日誌中提示Failure calling FinishInitialize.
由於提示到許可權問題,我用本地管理員許可權試驗了一下,右鍵Run As Admin是能正常啟動的,但日常使用用域成員許可權是不能啟動的,試圖使用devenv /SafeMode,乃至於 devenv /resetsettings都全部提示初始化問題。感覺是在非常靠前的時機就出問題了
用萬能的google搜尋了一下,找到了

這篇文章

這個討論比較長,最後我是參考這個解決的

Make sure you are logged in as the regular non-elevated user you use for running Visual Studio
Export your current VS settings with Tools | Import and Export Settings…, as the next steps will cause your settings to be lost
Download the attached workaround.txt
Launch a “Developer command prompt for VS 2017”
Run “csc Workaround.txt /target:exe”
Run Workaround.exe and add as a parameter the directory where your privateregistry.bin file resides. For example: “workaround.exe c:\users\\appdata\local\Microsoft\VisualStudio\15.0_[UniqueID]”

需要注意的是,一開始我這麼操作失敗了,原因是我最早按VS提示的定位跑去看ActivityLog.xml所在的
C:\Users\chenrq\AppData\Roaming\Microsoft\VisualStudio\15.0_[UniqueID] 目錄了,而實際上,需要操作的是
C:\Users\chenrq\AppData\Local\Microsoft\VisualStudio\15.0_[UniqueID] 這個目錄