Skip to content

Commit

Permalink
[ci] Prefer a stable .NET Core version (#4520)
Browse files Browse the repository at this point in the history
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3609773&view=logs&j=96fd57f5-f69e-53c7-3d47-f67e6cf9b93e&t=65256bb7-a34c-5353-bc4d-c02ee25dc133

Some builds have been failing with the following error:

	BuildJniEnvironment_g_cs:
	dotnet "/Users/builder/azdo/_work/211/s/xamarin-android/external/Java.Interop/bin/BuildRelease-netcoreapp3.1/jnienv-gen.dll" Java.Interop/JniEnvironment.g.cs obj/Release/netcoreapp3.1//jni.c
	It was not possible to find any compatible framework version
	The framework 'Microsoft.NETCore.App', version '3.1.2' was not found.
	    - The following frameworks were found:
	        2.1.12 at [/Users/builder/azdo/_work/_tool/dotnet/shared/Microsoft.NETCore.App]
	        3.1.0 at [/Users/builder/azdo/_work/_tool/dotnet/shared/Microsoft.NETCore.App]
	        5.0.0-preview.1.20120.5 at [/Users/builder/azdo/_work/_tool/dotnet/shared/Microsoft.NETCore.App]

It seems we have a 3.1 version installed in this case, but perhaps it's
not new enough.  Attempt to fix the error by always installing both our
required preview and stable versions of .NET Core.  Installing the
stable version last should result in it being the preferred SDK (and the
latest appended to $PATH).  Duplicating our `UseDotNet` usage, and the
side by side nature of .NET Core should allow our projects which
require a newer preview to continue to build.
  • Loading branch information
pjcollins authored Apr 3, 2020
1 parent 14f7d4d commit 1caee3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 12 additions & 1 deletion build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ variables:
InstallerArtifactName: installers
TestAssembliesArtifactName: test-assemblies
NUnitConsoleVersion: 3.9.0
DotNetCoreVersion: 3.x
# Version number from: https://dotnet.microsoft.com/download/dotnet-core/5.0
DotNetCoreVersion: 5.0.100-preview.1.20155.7
DotNetCorePreviewVersion: 5.0.100-preview.1.20155.7
HostedMacMojave: Hosted Mac Internal Mojave
HostedMac: Hosted Mac Internal
HostedWinVS2019: Hosted Windows 2019 with VS2019
Expand Down Expand Up @@ -98,6 +99,11 @@ stages:
- script: echo "##vso[task.setvariable variable=JAVA_HOME]$HOME/Library/Android/jdk"
displayName: set JAVA_HOME

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCorePreviewVersion)
inputs:
version: $(DotNetCorePreviewVersion)

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
Expand Down Expand Up @@ -240,6 +246,11 @@ stages:

- template: yaml-templates\clean.yaml

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCorePreviewVersion)
inputs:
version: $(DotNetCorePreviewVersion)

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ steps:
displayName: install test dependencies
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCorePreviewVersion)
inputs:
version: $(DotNetCorePreviewVersion)

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
Expand Down

0 comments on commit 1caee3a

Please sign in to comment.