From 2b3002662f8fc46660fbd09aae15dd27249d8d99 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 19 Dec 2019 14:14:36 -0500 Subject: [PATCH 1/2] [ci] Downgrade XA before Windows build Context: https://github.com/xamarin/xamarin-android/pull/4052#issuecomment-567576834 Our `Windows Build and Test` job runs on the same set of VMs that we use for testing and in some cases this can cause issues. Most recently, I noticed a failure when attempting to restore NuGet packages for `Xamarin.Android-Tests.sln`, because the Xamarin.Android version on disk is used when calculating the NuGet dependecy graph for Android projects. We should attempt to downgrade XA to the version that shipped with the instance of VS that we are building with before building on Windows. --- build-tools/automation/azure-pipelines.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index dc86f818352..27e77e2d68f 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -172,6 +172,18 @@ stages: inputs: version: $(DotNetCoreVersion) + # Downgrade the XA .vsix installed into the instance of VS that we are building with so that we don't restore/build against a test version. + # VSIXInstaller.exe will exit non-zero when the downgrade attempt is a no-op, so we will allow this step to fail silently. + - powershell: | + $vsixInstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe" + $ts = Get-Date -Format FileDateTimeUniversal + $log = "xavsixdowngrade-$ts.log" + $process = Start-Process -NoNewWindow -FilePath $vsixInstaller -ArgumentList "/downgrade:Xamarin.Android.Sdk /admin /quiet /logFile:$log" -Wait -PassThru + Get-Content "${env:TEMP}\$log" | Write-Host + Write-Host "VSInstaller.exe exited with code:" $process.ExitCode + Exit 0 + displayName: downgrade XA to stable + - task: MSBuild@1 displayName: msbuild Xamarin.Android /t:Prepare inputs: From 4987ab6c156086574ed7cfb6982313a57f96af36 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 19 Dec 2019 14:35:52 -0500 Subject: [PATCH 2/2] Delete temp vsixinstaller log --- build-tools/automation/azure-pipelines.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 27e77e2d68f..7032479f183 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -181,6 +181,7 @@ stages: $process = Start-Process -NoNewWindow -FilePath $vsixInstaller -ArgumentList "/downgrade:Xamarin.Android.Sdk /admin /quiet /logFile:$log" -Wait -PassThru Get-Content "${env:TEMP}\$log" | Write-Host Write-Host "VSInstaller.exe exited with code:" $process.ExitCode + Remove-Item "${env:TEMP}\$log" Exit 0 displayName: downgrade XA to stable