Visual Studio 2019使用docker开发(vsdbg的问题)

前言

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版本

本人亲测可行

posted @ 2019-12-30 17:12  一块白板  阅读(2946)  评论(0编辑  收藏  举报