Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to disable VSIX update service and collect VS update logs #91702

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions eng/collect_vsinfo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<#
.PARAMETER ArchiveRunName
Name of the run for vs logs

.NOTES
Returns 0 if succeeds, 1 otherwise
#>
[CmdletBinding(PositionalBinding=$false)]
Param (
[Parameter(Mandatory=$True)]
[string] $ArchiveRunName
)

. $PSScriptRoot/common/tools.ps1

$vscollect_uri="http://aka.ms/vscollect.exe"
$vscollect="$env:TEMP\vscollect.exe"

if (-not (Test-Path $vscollect)) {
Retry({
Write-Host "GET $vscollect_uri"
Invoke-WebRequest $vscollect_uri -OutFile $vscollect -UseBasicParsing
})

if (-not (Test-Path $vscollect)) {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to download vscollect."
exit 1
}
}

&"$vscollect"

$LogDir = Join-Path $LogDir $ArchiveRunName
mkdir $LogDir
Move-Item $env:TEMP\vslogs.zip "$LogDir"

$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path -Path "$vswhere" -PathType Leaf))
{
Write-Error "Couldn't locate vswhere at $vswhere"
exit 1
}

&"$vswhere" -all -prerelease -products * | Tee-Object -FilePath "$LogDir\vs_where.log"
23 changes: 23 additions & 0 deletions eng/disable_vsupdate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
schtasks /change /tn "\Microsoft\VisualStudio\VSIX Auto Update" /disable

$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path -Path "$vswhere" -PathType Leaf))
{
Write-Error "Couldn't locate vswhere at $vswhere"
exit 1
}

$vsdir = &"$vswhere" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$vsregedit = "$vsdir\Common7\IDE\VsRegEdit.exe"

if (-not (Test-Path -Path "$vsregedit" ))
{
Write-Error "VSWhere returned path: $vsdir, but regedit $vsregedit doesn't exist."
exit 1
}

Write-Output "VSWhere returned path: $vsdir, using regedit $vsregedit"
Write-Output "Disabling updates through VS Registry:"

&"$vsdir\Common7\IDE\VsRegEdit.exe" set local HKCU ExtensionManager AutomaticallyCheckForUpdates2Override dword 0
&"$vsdir\Common7\IDE\VsRegEdit.exe" read local HKCU ExtensionManager AutomaticallyCheckForUpdates2Override dword
6 changes: 6 additions & 0 deletions eng/native/init-vs-env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ if defined VisualStudioVersion goto :VSDetected
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
set "__VSCOMNTOOLS="

if not exist "%__VSWhere%" goto :VSWhereMissing

if exist "%__VSWhere%" (
for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath'
Expand Down Expand Up @@ -56,6 +58,10 @@ echo %__MsgPrefix%Error: Visual Studio 2022 with C++ tools required. ^
Please see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/windows-requirements.md for build requirements.
exit /b 1

:VSWhereMissing
echo %__MsgPrefix%Error: vswhere couldn not be found in Visual Studio Installer directory at "%__VSWhere%"
exit /b 1

:SetVCEnvironment

if "%__VCBuildArch%"=="" exit /b 0
Expand Down
12 changes: 12 additions & 0 deletions eng/pipelines/common/global-build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ jobs:
clean: true
fetchDepth: $(checkoutFetchDepth)

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/disable_vsupdate.ps1
./eng/collect_vsinfo.ps1 -ArchiveName initialization_log
displayName: Collect vslogs on Entry and disable updates
condition: always()

- ${{ if and(eq(parameters.isOfficialBuild, true), notin(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator')) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml

Expand Down Expand Up @@ -229,6 +236,11 @@ jobs:
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
${{ insert }}: ${{ parameters.extraStepsParameters }}

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/collect_vsinfo.ps1 -ArchiveName postbuild_log
displayName: Collect vslogs on exit

- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
Expand Down
14 changes: 14 additions & 0 deletions eng/pipelines/coreclr/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ jobs:
- ${{ parameters.variables }}

steps:
- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/disable_vsupdate.ps1
./eng/collect_vsinfo.ps1 -ArchiveName initialization_log
displayName: Collect vslogs on Entry and disable updates
condition: always()


# Install native dependencies
# Linux builds use docker images with dependencies preinstalled,
Expand Down Expand Up @@ -275,6 +282,13 @@ jobs:
parameters:
name: ${{ parameters.platform }}

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/collect_vsinfo.ps1 -ArchiveName postbuild_log
displayName: Collect vslogs on exit
condition: always()


# Publish Logs
- task: PublishPipelineArtifact@1
displayName: Publish Logs
Expand Down
14 changes: 14 additions & 0 deletions eng/pipelines/installer/jobs/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ jobs:
clean: true
fetchDepth: $(checkoutFetchDepth)

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/disable_vsupdate.ps1
./eng/collect_vsinfo.ps1 -ArchiveName initialization_log
displayName: Collect vslogs on Entry and disable updates
condition: always()

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if ne(parameters.osGroup, 'windows') }}:
- task: Bash@3
Expand Down Expand Up @@ -376,6 +383,13 @@ jobs:
displayName: Build and Package
continueOnError: ${{ and(eq(variables.SkipTests, false), eq(parameters.shouldContinueOnError, true)) }}

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/collect_vsinfo.ps1 -ArchiveName postbuild_log
displayName: Collect vslogs on exit
condition: always()


- ${{ if in(parameters.osGroup, 'osx', 'ios', 'tvos') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
Expand Down
12 changes: 12 additions & 0 deletions eng/pipelines/mono/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ jobs:
df -h
displayName: Disk Usage before Build

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/disable_vsupdate.ps1
./eng/collect_vsinfo.ps1 -ArchiveName initialization_log
displayName: Collect vslogs on Entry and disable updates
condition: always()

# Build
- ${{ if ne(parameters.osGroup, 'windows') }}:
- script: ./build$(scriptExt) -subset mono+clr.hosts $(crossArg) -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) $(darwinFrameworks)
Expand Down Expand Up @@ -171,6 +178,11 @@ jobs:
- script: build$(scriptExt) -subset mono+clr.hosts -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) -pack $(OutputRidArg)
displayName: Build nupkg

- ${{ if eq(parameters.osGroup, 'windows') }}:
- powershell: |
./eng/collect_vsinfo.ps1 -ArchiveName postbuild_log
displayName: Collect vslogs on exit
condition: always()
# Publish Logs
- task: PublishPipelineArtifact@1
displayName: Publish Logs
Expand Down