Skip to content

Commit 5861cc8

Browse files
Bump to .NET 8
Changes: dotnet/installer@11f6b8f...d552037 Changes: dotnet/linker@5f9bfd9...493ce62 Changes: dotnet/runtime@6d10e4c...b8d4980 A summary of what it took to get this working: * Run `darc update-dependencies --id 152596` * Setup .NET 6,7,8 "multi-targeting" * Setup dotnet6/dotnet7/dotnet8 NuGet feeds * `$(DotNetTargetFrameworkVersion)` should be 8.0 * Rename API diff for `net8.0` * Fix `AutoImport.props` for 8.0 * Update `.apkdesc` files * Update `CheckIncludedAssemblies` test * Use .NET Core `3.1.x` Trying to avoid: dotnet-install: Failed to locate the latest version in the channel '3.1.417' with 'preview' quality for 'dotnet-sdk', os: 'win', architecture: 'x64'. * Install .NET 6 for legacy MSBuild tests * [Mono.Android.Export] fix `NotSupportedException` Context: https://github.com/mono/mono/blob/242ac50598e4f596e1a42f9dd377701096ea3a74/mcs/class/referencesource/mscorlib/system/reflection/emit/dynamicmethod.cs#L276-L277 Context: dotnet/runtime@e465230 System.NotSupportedException: Wrong MethodAttributes or CallingConventions for DynamicMethod. Only public, static, standard supported * Use correct Mono pack names for `$(AotAssemblies)` * Fix `DotNetPublish` test Was failing with: Build should be using C:\a_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Ref.33\34.0.0-ci.pr.gh7451.52\ref\net7.0\Mono.Android.dll Expected: True But was: False * Remove a `net7.0` assertion for build warnings See: dotnet/runtime#77385 * Pass `-SkipNonVersionedFiles` to `dotnet-install` scripts to avoid: dotnet --info Exited with code: 137
1 parent ab6712a commit 5861cc8

File tree

35 files changed

+225
-215
lines changed

35 files changed

+225
-215
lines changed

Configuration.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<DebugType Condition=" '$(DebugType)' == '' ">portable</DebugType>
4848
<Deterministic Condition=" '$(Deterministic)' == '' ">True</Deterministic>
4949
<LangVersion Condition=" '$(LangVersion)' == '' ">latest</LangVersion>
50+
<AndroidNet7Version Condition=" '$(AndroidNet7Version)' == '' ">33.0.1</AndroidNet7Version>
5051
<AndroidNet6Version Condition=" '$(AndroidNet6Version)' == '' ">32.0.476</AndroidNet6Version>
5152
</PropertyGroup>
5253
<PropertyGroup Condition=" '$(HostOS)' == '' ">

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project>
22

33
<PropertyGroup>
4-
<DotNetTargetFrameworkVersion>7.0</DotNetTargetFrameworkVersion>
4+
<DotNetTargetFrameworkVersion>8.0</DotNetTargetFrameworkVersion>
55
<DotNetTargetFramework>net$(DotNetTargetFrameworkVersion)</DotNetTargetFramework>
66
<DotNetAndroidTargetFramework>$(DotNetTargetFramework)-android</DotNetAndroidTargetFramework>
77
<!-- Used for bootstrap, command-line tooling, and desktop NUnit projects -->
8-
<DotNetStableTargetFramework>net6.0</DotNetStableTargetFramework>
8+
<DotNetStableTargetFramework>net7.0</DotNetStableTargetFramework>
99
<TargetFrameworkNETStandard>netstandard2.0</TargetFrameworkNETStandard>
1010
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1111
<BuildOutputDirectory>$(MSBuildThisFileDirectory)bin\$(Configuration)\</BuildOutputDirectory>

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUNTIME := $(shell which mono64 2> /dev/null && echo mono64 || echo mono)
77
SOLUTION = Xamarin.Android.sln
88
TEST_TARGETS = build-tools/scripts/RunTests.targets
99
API_LEVEL ?=
10-
PREPARE_NET_FX = net6.0
10+
PREPARE_NET_FX = net7.0
1111
PREPARE_ARGS =
1212
PREPARE_PROJECT = build-tools/xaprepare/xaprepare/xaprepare.csproj
1313
PREPARE_MSBUILD_FLAGS = $(PREPARE_MSBUILD_ARGS) $(MSBUILD_ARGS)

NuGet.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
<!-- ensure only the sources defined below are used -->
66
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
77
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
8-
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
8+
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
99
<!-- This is needed (currently) for the Xamarin.Android.Deploy.Installer dependency, getting the installer -->
1010
<!-- Android binary, to support delta APK install -->
1111
<add key="xamarin.android util" value="https://pkgs.dev.azure.com/xamarin/public/_packaging/Xamarin.Android/nuget/v3/index.json" />
12-
<!-- Added manually for dotnet/runtime 6.0.9 -->
13-
<add key="darc-pub-dotnet-emsdk-3f6c45a" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-3f6c45a2/nuget/v3/index.json" />
14-
<add key="darc-pub-dotnet-runtime-8c6bcad" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-8c6bcad1/nuget/v3/index.json" />
12+
<!-- Added manually for dotnet/runtime 6.0.11 -->
13+
<add key="darc-pub-dotnet-emsdk-c3fc739" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-c3fc739c/nuget/v3/index.json" />
14+
<add key="darc-pub-dotnet-runtime-1e1f688" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-1e1f688d/nuget/v3/index.json" />
1515
</packageSources>
1616
<disabledPackageSources />
1717
</configuration>

build-tools/automation/azure-pipelines.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ stages:
179179
# xabuild still depends on .NET Core 3 or earlier
180180
- template: yaml-templates\use-dot-net.yaml
181181
parameters:
182-
version: 3.1.417
182+
version: 3.1
183+
quality: GA
183184

184185
# 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.
185186
# The VS installer will attempt to resume any failed or partial installation before trying to downgrade Xamarin.Android.

build-tools/automation/yaml-templates/setup-test-environment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ steps:
3636
displayName: set JI_JAVA_HOME
3737
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
3838

39+
# Install .NET 6 for legacy tests
3940
- template: use-dot-net.yaml
4041
parameters:
42+
version: 6.0
43+
quality: GA
4144
remove_dotnet: ${{ parameters.remove_dotnet }}
4245

46+
# Install latest .NET
47+
- template: use-dot-net.yaml
48+
4349
- task: DotNetCoreCLI@2
4450
displayName: shut down existing build daemons
4551
inputs:

build-tools/automation/yaml-templates/use-dot-net.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
parameters:
55
version: $(DotNetSdkVersion)
6+
quality: $(DotNetSdkQuality)
67
remove_dotnet: false
78

89
steps:
@@ -37,7 +38,7 @@ steps:
3738
$sleepTime = $sleepTime * 2
3839
}
3940
}
40-
& .\dotnet-install.ps1 -Version ${{ parameters.version }} -InstallDir $DotNetRoot -Verbose
41+
& .\dotnet-install.ps1 -Channel ${{ parameters.version }} -Quality ${{ parameters.quality }} -InstallDir $DotNetRoot -SkipNonVersionedFiles -Verbose
4142
displayName: install .NET Core ${{ parameters.version }}
4243
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
4344
@@ -46,7 +47,7 @@ steps:
4647
(if [[ "${{ parameters.remove_dotnet }}" == "true" ]] ; then rm -rfv $DOTNET_ROOT; fi) &&
4748
curl -L https://dot.net/v1/dotnet-install.sh --retry 5 --retry-max-time 300 > dotnet-install.sh &&
4849
chmod +x dotnet-install.sh &&
49-
./dotnet-install.sh --version ${{ parameters.version }} --install-dir $DOTNET_ROOT --verbose &&
50+
./dotnet-install.sh --channel ${{ parameters.version }} --quality ${{ parameters.quality }} --install-dir $DOTNET_ROOT --skip-non-versioned-files --verbose &&
5051
PATH="$DOTNET_ROOT:$PATH" &&
5152
echo "##vso[task.setvariable variable=DOTNET_ROOT]$DOTNET_ROOT" &&
5253
echo "##vso[task.setvariable variable=PATH]$PATH"

build-tools/automation/yaml-templates/variables.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ variables:
1818
- name: NUnit.NumberOfTestWorkers
1919
value: 4
2020
- name: DotNetSdkVersion
21-
value: 6.0.300
21+
value: 7.0.1xx
22+
- name: DotNetSdkQuality
23+
value: preview
2224
- name: GitHub.Token
2325
value: $(github--pat--vs-mobiletools-engineering-service2)
2426
- name: HostedMacImage
@@ -32,9 +34,9 @@ variables:
3234
- name: TeamName
3335
value: XamarinAndroid
3436
- name: DotNetTargetFramework
35-
value: net7.0
37+
value: net8.0
3638
- name: DotNetStableTargetFramework
37-
value: net6.0
39+
value: net7.0
3840
# Workaround: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1585820
3941
- name: _WriteTelemetryProperties
4042
value: false

build-tools/create-packs/Directory.Build.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@
122122
</PropertyGroup>
123123
<ItemGroup>
124124
<_NuGetSources Include="$(OutputPath.TrimEnd('\'))" />
125-
<!-- This allows us to install our Android .NET 6 packs -->
125+
<!-- This allows us to install our older Android .NET packs -->
126+
<_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
126127
<_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
127128
<_PreviewPacks Condition=" '$(AndroidLatestStableApiLevel)' != '$(AndroidLatestUnstableApiLevel)' " Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Ref.$(AndroidLatestUnstableApiLevel).*.nupkg" />
128129
<_InstallArguments Include="android" />

build-tools/create-packs/Microsoft.NET.Sdk.Android.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ about the various Microsoft.Android workloads.
3535
<ReplaceFileContents
3636
SourceFile="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.NET.Sdk.Android\WorkloadManifest.in.json"
3737
DestinationFile="$(WorkloadManifestJsonPath)"
38-
Replacements="@WORKLOAD_VERSION@=$(WorkloadVersion);@NET6_VERSION@=$(AndroidNet6Version)">
38+
Replacements="@WORKLOAD_VERSION@=$(WorkloadVersion);@NET7_VERSION@=$(AndroidNet7Version);@NET6_VERSION@=$(AndroidNet6Version)">
3939
</ReplaceFileContents>
4040
<ReplaceFileContents
4141
SourceFile="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.NET.Sdk.Android\WorkloadManifest.in.targets"
4242
DestinationFile="$(WorkloadManifestTargetsPath)"
43-
Replacements="@NET6_VERSION@=$(AndroidNet6Version)">
43+
Replacements="@NET7_VERSION@=$(AndroidNet7Version);@NET6_VERSION@=$(AndroidNet6Version)">
4444
</ReplaceFileContents>
4545

4646
<ItemGroup>

0 commit comments

Comments
 (0)