前言
vsdbg在國內下載的速度真的很慢,借助迅雷也沒辦法起飛。
這里還是來探討下如何用迅雷進行下載以后安裝操作。
遇到的狀況
在使用Visual Studio 2019進行開發調試(https://docs.microsoft.com/zh-cn/visualstudio/containers/edit-and-refresh?view=vs-2019)時控制台輸出如下信息
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File "C:\Users\xx\AppData\Local\Temp\GetVsDbg.ps1" -Version vs2017u5 -RuntimeID linux-x64 -InstallPath "C:\Users\xx\vsdbg\vs2017u5"
但是由於網絡原因可能產生各種錯誤。
解決方案
修改PS1文件(C:\Users\xx\AppData\Local\Temp\GetVsDbg.ps1)。
增加 11 行,注釋 12 行
1 if (IsLatest $InstallPath $RuntimeID $VersionNumber) { 2 Write-Host "Info: Latest version of VsDbg is present. Skipping downloads" 3 } else { 4 if (Test-Path $InstallPath) { 5 Write-Host "Info: $InstallPath exists, deleting." 6 Remove-Item $InstallPath -Force -Recurse -ErrorAction Stop 7 } 8 9 $target = ("vsdbg-" + $VersionNumber).Replace('.','-') + "/vsdbg-" + $RuntimeID + ".zip" 10 $url = "https://vsdebugger.azureedge.net/" + $target 11 echo $url 12 # DownloadAndExtract $url $InstallPath 13 # WriteSuccessInfo $InstallPath $RuntimeID $VersionNumber 14 # Write-Host "Info: Successfully installed vsdbg at '$InstallPath'" 15 }
打開Powershell,切換到C:\Users\xx\AppData\Local\Temp目錄,執行
./GetVsDbg.ps1 -Version vs2017u5 -RuntimeID linux-x64 -InstallPath "C:\Users\xx\vsdbg\vs2017u5" # 輸出: Info: Using vsdbg version '16.3.10904.1' Info: Using Runtime ID 'linux-x64'https://vsdebugger.azureedge.net/vsdbg-16-3-10904-1/vsdbg-linux-x64.zip
如果遇到執行權限問題可以執行一下命令,並 ‘y’
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
將https://vsdebugger.azureedge.net/vsdbg-16-3-10904-1/vsdbg-linux-x64.zip拷貝至下載工具下載並解壓到 C:\Users\xx\vsdbg\vs2017u5
修改GetVsDbg.ps1 ,取消目錄檢測刪除,進行安裝成功信息寫入
注釋 4-7 行
1 if (IsLatest $InstallPath $RuntimeID $VersionNumber) { 2 Write-Host "Info: Latest version of VsDbg is present. Skipping downloads" 3 } else { 4 # if (Test-Path $InstallPath) { 5 # Write-Host "Info: $InstallPath exists, deleting." 6 # Remove-Item $InstallPath -Force -Recurse -ErrorAction Stop 7 # } 8 9 $target = ("vsdbg-" + $VersionNumber).Replace('.','-') + "/vsdbg-" + $RuntimeID + ".zip" 10 $url = "https://vsdebugger.azureedge.net/" + $target 11 # echo $url 12 # DownloadAndExtract $url $InstallPath 13 WriteSuccessInfo $InstallPath $RuntimeID $VersionNumber 14 Write-Host "Info: Successfully installed vsdbg at '$InstallPath'" 15 }
重新執行命令
./GetVsDbg.ps1 -Version vs2017u5 -RuntimeID linux-x64 -InstallPath "C:\Users\xx\vsdbg\vs2017u5"
使用同樣的方法安裝linux-musl-x64版本
本人親測可行