Skip to content

Commit 28dbfe4

Browse files
authored
[ci] Show VS & MSBuild install locations on Windows (#4833)
Context: https://github.com/xamarin/yaml-templates/blob/cf440bcf4daf0305be17280bf27854480314db77/environment/win/vs-msbuild.v1.yml Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3795214&view=logs&j=cac0e8d3-0ef5-5d2b-b57e-e8fde7204df3&t=b0ec5c6c-f5a1-5ebf-2068-57a5c78a6a85 There have been a few issues involving Xamarin.Android builds on Windows involving problems with the Visual Studio installation or an incorrect (older) version of MSBuild being invoked: ##[debug]Entering Invoke-VstsTool. ##[debug] FileName: 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe' ##[debug] Arguments: '"C:\A\vs2019xam000013-1\_work\2\s\Xamarin.Android.sln" … /t:Prepare /p:AutoProvision=true /bl:C:\A\vs2019xam000013-1\_work\2\s\bin\BuildRelease\msbuild-prepare.binlog … ##[debug] RequireExitCodeZero: 'True' "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" … MSBUILD : error MSB1001: Unknown switch. Switch: /bl:C:\A\vs2019xam000013-1\_work\2\s\bin\BuildRelease\msbuild-prepare.binlog For switch syntax, type "MSBuild /help" ##[debug]Exit code: 1 We're not entirely sure why this happens. Add a template include to `environment/win/vs-msbuild.v1.yml@yaml`, which adds two new steps to **Windows** > **Build and Smoke Test**: * `Env: Create Write-MSBuildPath.ps1`, which creates a PowerShell script * `Env: Visual Studio (Windows)`, which invokes the `Write-MSBuildPath.ps1` script, printing out information about the currently installed Visual Studio instances. The new steps provide visibility into the Visual Studio and MSBuild installations, utilizing `vswhere` as a means to enumerate and obtain the Visual Studio installs on the agent. Additionally, the template being called leverages code from the MSBuild task to locate the version of MSBuild that will be used: Visual Studio installations based on the vswhere.exe command … [ { … "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", … Visual Studio installed products: Microsoft.VisualStudio.Product.Enterprise 16.6.30114.105: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise IsComplete: True IsLaunchable: True IsRebootRequired: False MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe
1 parent 2181e78 commit 28dbfe4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ stages:
271271
displayName: downgrade XA to stable
272272
ignoreLASTEXITCODE: true
273273
274+
- template: environment/win/vs-msbuild.v1.yml@yaml # Display (in log) VS installation(s) including installation status with associated MSBuild location(s)
275+
274276
- task: MSBuild@1
275277
displayName: msbuild Xamarin.Android /t:Prepare
276278
inputs:

build-tools/automation/yaml-templates/run-msbuild-win-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717

1818
- template: clean.yaml
1919

20+
- template: environment/win/vs-msbuild.v1.yml@yaml # Display (in log) VS installation(s) including installation status with associated MSBuild location(s)
21+
2022
- template: setup-test-environment.yaml
2123
parameters:
2224
provisionExtraArgs: -vv PROVISIONATOR_VISUALSTUDIO_LOCATION="$(VSINSTALLDIR)" -f

0 commit comments

Comments
 (0)