1 2 3 4 5 6 |
========== 正在准备容器 ========== 正在准备 Docker 容器... C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File "C:\Users\MESTC\AppData\Local\Temp\GetVsDbg.ps1" -Version vs2017u5 -RuntimeID linux-x64 -InstallPath "C:\Users\MESTC\vsdbg\vs2017u5" Info: Using vsdbg version '16.0.20412.1' Info: Using Runtime ID 'linux-x64' Info: C:\Users\MESTC\vsdbg\vs2017u5 exists, deleting. |
如上情况
感兴趣可以打开 GetVsDbg.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# Copyright (c) Microsoft. All rights reserved. <# .SYNOPSIS Downloads the given $Version of vsdbg for the given $RuntimeID and installs it to the given $InstallPath .DESCRIPTION The following script will download vsdbg and install vsdbg, the .NET Core Debugger .PARAMETER Version Specifies the version of vsdbg to install. Can be 'latest', 'vs2019', 'vs2017u5', 'vs2017u1', or a specific version string i.e. 15.0.25930.0 .PARAMETER RuntimeID Specifies the .NET Runtime ID of the vsdbg that will be downloaded. Example: linux-x64. Defaults to win7-x64. .Parameter InstallPath Specifies the path where vsdbg will be installed. Defaults to the directory containing this script. .INPUTS None. You cannot pipe inputs to GetVsDbg. .EXAMPLE C:\PS> .\GetVsDbg.ps1 -Version latest -RuntimeID linux-x64 -InstallPath .\vsdbg .LINK For more information about using this script with Visual Studio Code see: https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes For more information about using this script with Visual Studio see: https://github.com/Microsoft/MIEngine/wiki/Offroad-Debugging-of-.NET-Core-on-Linux---OSX-from-Visual-Studio To report issues, see: https://github.com/omnisharp/omnisharp-vscode/issues #> Param ( [Parameter(Mandatory=$true, ParameterSetName="ByName")] [string] [ValidateSet("latest", "vs2019", "vs2017u1", "vs2017u5")] $Version, [Parameter(Mandatory=$true, ParameterSetName="ByNumber")] [string] [ValidatePattern("\d+\.\d+\.\d+.*")] $VersionNumber, [Parameter(Mandatory=$false)] [string] $RuntimeID, [Parameter(Mandatory=$false)] [string] $InstallPath = (Split-Path -Path $MyInvocation.MyCommand.Definition) ) $ErrorActionPreference="Stop" # In a separate method to prevent locking zip files. function DownloadAndExtract([string]$url, [string]$targetLocation) { Add-Type -assembly "System.IO.Compression.FileSystem" Add-Type -assembly "System.IO.Compression" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Try { $zipStream = (New-Object System.Net.WebClient).OpenRead($url) } Catch { Write-Host "Info: Opening stream failed, trying again with proxy settings." $proxy = [System.Net.WebRequest]::GetSystemWebProxy() $proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials $webClient = New-Object System.Net.WebClient $webClient.UseDefaultCredentials = $false $webClient.proxy = $proxy $zipStream = $webClient.OpenRead($url) } $zipArchive = New-Object System.IO.Compression.ZipArchive -ArgumentList $zipStream [System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($zipArchive, $targetLocation) $zipArchive.Dispose() $zipStream.Dispose() } # Checks if the existing version is the latest version. function IsLatest([string]$installationPath, [string]$runtimeId, [string]$version) { $SuccessRidFile = Join-Path -Path $installationPath -ChildPath "success_rid.txt" if (Test-Path $SuccessRidFile) { $LastRid = Get-Content -Path $SuccessRidFile if ($LastRid -ne $runtimeId) { return $false } } else { return $false } $SuccessVersionFile = Join-Path -Path $installationPath -ChildPath "success_version.txt" if (Test-Path $SuccessVersionFile) { $LastVersion = Get-Content -Path $SuccessVersionFile if ($LastVersion -ne $version) { return $false } } else { return $false } return $true } function WriteSuccessInfo([string]$installationPath, [string]$runtimeId, [string]$version) { $SuccessRidFile = Join-Path -Path $installationPath -ChildPath "success_rid.txt" $runtimeId | Out-File -Encoding utf8 $SuccessRidFile $SuccessVersionFile = Join-Path -Path $installationPath -ChildPath "success_version.txt" $version | Out-File -Encoding utf8 $SuccessVersionFile } $ExplitVersionNumberUsed = $false if ($Version -eq "latest") { $VersionNumber = "16.0.20412.1" } elseif ($Version -eq "vs2019") { $VersionNumber = "16.0.20412.1" } elseif ($Version -eq "vs2017u5") { $VersionNumber = "16.0.20412.1" } elseif ($Version -eq "vs2017u1") { $VersionNumber = "15.1.10630.1" } else { $ExplitVersionNumberUsed = $true } Write-Host "Info: Using vsdbg version '$VersionNumber'" if (-not $RuntimeID) { $RuntimeID = "win7-x64" } elseif (-not $ExplitVersionNumberUsed) { $legacyLinuxRuntimeIds = @{ "debian.8-x64" = ""; "rhel.7.2-x64" = ""; "centos.7-x64" = ""; "fedora.23-x64" = ""; "opensuse.13.2-x64" = ""; "ubuntu.14.04-x64" = ""; "ubuntu.16.04-x64" = ""; "ubuntu.16.10-x64" = ""; "fedora.24-x64" = ""; "opensuse.42.1-x64" = ""; } # Remap the old distro-specific runtime ids unless the caller specified an exact build number. # We don't do this in the exact build number case so that old builds can be used. if ($legacyLinuxRuntimeIds.ContainsKey($RuntimeID.ToLowerInvariant())) { $RuntimeID = "linux-x64" } } Write-Host "Info: Using Runtime ID '$RuntimeID'" # if we were given a relative path, assume its relative to the script directory and create an absolute path if (-not([System.IO.Path]::IsPathRooted($InstallPath))) { $InstallPath = Join-Path -Path (Split-Path -Path $MyInvocation.MyCommand.Definition) -ChildPath $InstallPath } if (IsLatest $InstallPath $RuntimeID $VersionNumber) { Write-Host "Info: Latest version of VsDbg is present. Skipping downloads" } else { if (Test-Path $InstallPath) { Write-Host "Info: $InstallPath exists, deleting." Remove-Item $InstallPath -Force -Recurse -ErrorAction Stop } $target = ("vsdbg-" + $VersionNumber).Replace('.','-') + "/vsdbg-" + $RuntimeID + ".zip" $url = "https://vsdebugger.azureedge.net/" + $target DownloadAndExtract $url $InstallPath WriteSuccessInfo $InstallPath $RuntimeID $VersionNumber Write-Host "Info: Successfully installed vsdbg at '$InstallPath'" } |
1 2 3 4 5 6 |
========== 正在准备容器 ========== 正在准备 Docker 容器... C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File "C:\Users\MESTC\AppData\Local\Temp\GetVsDbg.ps1" -Version vs2017u5 -RuntimeID linux-x64 -InstallPath "C:\Users\MESTC\vsdbg\vs2017u5" Info: Using vsdbg version '16.0.20412.1' Info: Using Runtime ID 'linux-x64' Info: C:\Users\MESTC\vsdbg\vs2017u5 exists, deleting. |
下面说说解决方案
下载包
1 |
https://vsdebugger.azureedge.net/vsdbg-(你的版本号.号换成-号)/vsdbg-(你的Runtime ID).zip |
1 |
例如我的 |
1 2 3 |
https://vsdebugger.azureedge.net/vsdbg-16-0-20412-1/vsdbg-linux-x64.zip 下载之后解压到你的安装路径 例如我的 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
-InstallPath "C:\Users\MESTC\vsdbg\vs2017u5" 然后在该文件下添加一个<em>success_rid.txt文件,内容为</em>你的Runtime ID 例如我的linux-x64 还要添加一个success_version.txt文件,内容为你的版本号,如16.0.20412.1 重启 visual studio 下面还会下载另一个,相同的处理方式,再重启一次就ok了 最新版操作过程 最新下载文件路径 https://vsdebugger.azureedge.net/vsdbg-16-2-10709-2/vsdbg-linux-x64.zip https://vsdebugger.azureedge.net/vsdbg-16-2-10709-2/vsdbg-linux-musl-x64.zip 解压路径 |
1 |
C:\Users\用户名\vsdbg\vs2017u5 -> vsdbg-linux-x64.zip |
1 2 3 4 |
C:\Users\用户名\vsdbg\vs2017u5\linux-musl-x64 -> vsdbg-linux-musl-x64.zip 解压完了,在路径 C:\Users\用户名\vsdbg\vs2017u5 里面 新建 <em>success_rid.txt 编辑内容 </em>linux-x64,再新建 success_version.txt <em>编辑内容 16.2.10709.2 </em> |
1 |
在路径 C:\Users\用户名\vsdbg\vs2017u5\linux-musl-x64 里面 新建 <em>success_rid.txt 编辑内容 </em>linux-musl-x64,再新建 success_version.txt <em>编辑内容 16.2.10709.2<br>完成</em> |