Add .NET 8 target (Avalonia 11.1) (#14535)

* Add .NET 8 target to packable projects

* Update test projects

* Update sample projects to target .NET 8

* Update main Avalonia package to target .NET 8 as well

* Remove MSBuildEnableWorkloadResolver hack and some minor change

* Use net8.0 in nuke build as well

* Pin 8.0.0 SDK

* Adjust API validation

* Pin a valid version

* Remove net461 target from Avalonia package

* Remove unused net6.0 target from Avalonia.Designer.HostApp

* Adjust API diff

* Update ControlCatalog.Android.csproj

* Remove MSBuildEnableWorkloadResolver

* Fix Browser issues on .NET 8

* Fix .NET 8 error

* Fix merge conflicts

* Replace explicit TFMs in .csproj files with a centralized registry

* Fix merge conflict

* Fix AvsLegacyWindowsTargetFrameworks and add hacks for the tests

* Update XCode project CommandLineArgument

---------

Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>
This commit is contained in:
Max Katz
2024-03-05 13:37:26 -08:00
committed by GitHub
parent 3657128cd2
commit 326ef7c9fd
108 changed files with 282 additions and 192 deletions
+10 -3
View File
@@ -110,8 +110,8 @@ public static class ApiDiffHelper
private static readonly (string oldTfm, string newTfm)[] s_tfmRedirects = new[]
{
// We use StartsWith below comparing these tfm, as we ignore platform versions (like, net6.0-ios16.1)
("net6.0-android", "net7.0-android"),
("net6.0-ios", "net7.0-ios"),
("net6.0-android", "net8.0-android"),
("net6.0-ios", "net8.0-ios"),
// Designer was moved from netcoreapp to netstandard
("netcoreapp2.0", "netstandard2.0")
};
@@ -171,8 +171,15 @@ public static class ApiDiffHelper
if (targetDll?.entry is null)
{
if (packageId == "Avalonia"
&& baselineDll.target is "net461" or "netcoreapp2.0")
{
// In 11.1 we have removed net461 and netcoreapp2.0 targets from Avalonia package.
continue;
}
var actualTargets = string.Join(", ",
targetDlls.Select(d => $"{d.target} ({baselineDll.entry.Name})"));
targetDlls.Select(d => $"{d.target} ({d.entry.Name})"));
throw new InvalidOperationException(
$"Some assemblies are missing in the new package {packageId}: {baselineDll.entry.Name} for {baselineDll.target}."
+ $"\r\nActual targets: {actualTargets}.");
+14 -4
View File
@@ -176,19 +176,29 @@ partial class Build : NukeBuild
foreach (var fw in targetFrameworks)
{
if (fw.StartsWith("net4")
var tfm = fw;
if (tfm == "$(AvsCurrentTargetFramework)")
{
tfm = "net8.0";
}
if (tfm == "$(AvsLegacyTargetFrameworks)")
{
tfm = "net6.0";
}
if (tfm.StartsWith("net4")
&& (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
&& Environment.GetEnvironmentVariable("FORCE_LINUX_TESTS") != "1")
{
Information($"Skipping {projectName} ({fw}) tests on *nix - https://github.com/mono/mono/issues/13969");
Information($"Skipping {projectName} ({tfm}) tests on *nix - https://github.com/mono/mono/issues/13969");
continue;
}
Information($"Running for {projectName} ({fw}) ...");
Information($"Running for {projectName} ({tfm}) ...");
DotNetTest(c => ApplySetting(c)
.SetProjectFile(project)
.SetFramework(fw)
.SetFramework(tfm)
.EnableNoBuild()
.EnableNoRestore()
.When(Parameters.PublishTestResults, _ => _
+3 -1
View File
@@ -6,7 +6,9 @@
<IsPackable>False</IsPackable>
<NoWarn>$(NoWarn);CS0649;CS0169;SYSLIB0011</NoWarn>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
<!-- See https://github.com/nuke-build/nuke/issues/818 -->
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<!-- Necessary for Microsoft.DotNet.GenAPI.Tool -->
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json</RestoreAdditionalProjectSources>
</PropertyGroup>