Add support for .NET 9 SDK and runtime

This commit is contained in:
2024-11-14 23:05:25 +02:00
parent a1b3610af8
commit dd894b510d
5 changed files with 18 additions and 7 deletions

View File

@@ -19,6 +19,8 @@ class PlatformTools;
#define GAME_BUILD_DOTNET_VER TEXT("") #define GAME_BUILD_DOTNET_VER TEXT("")
#endif #endif
#define COOKER_MIN_DOTNET_RUNTIME_VERSION 8
/// <summary> /// <summary>
/// Game building options. Used as flags. /// Game building options. Used as flags.
/// </summary> /// </summary>

View File

@@ -117,7 +117,11 @@ bool DeployDataStep::Perform(CookingData& data)
for (String& version : versions) for (String& version : versions)
{ {
version = String(StringUtils::GetFileName(version)); version = String(StringUtils::GetFileName(version));
if (!version.StartsWith(TEXT("8."))) // Check for major part of 8.0 const int32 dot = version.Find('.');
int majorVersion = 0;
if (dot != -1)
StringUtils::Parse(version.Substring(0, dot).Get(), &majorVersion);
if (majorVersion >= COOKER_MIN_DOTNET_RUNTIME_VERSION) // Check for major part of 8.0
version.Clear(); version.Clear();
} }
Sorting::QuickSort(versions); Sorting::QuickSort(versions);

View File

@@ -1,5 +1,7 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if !NET9_0_OR_GREATER
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -674,3 +676,5 @@ namespace FlaxEngine.Collections
public object Current => Entry; public object Current => Entry;
} }
} }
#endif

View File

@@ -1758,7 +1758,7 @@ bool InitHostfxr()
// Warn user about missing .Net // Warn user about missing .Net
#if PLATFORM_DESKTOP #if PLATFORM_DESKTOP
Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet/8.0")); Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet"));
#endif #endif
#if USE_EDITOR #if USE_EDITOR
LOG(Fatal, "Missing .NET 8 or later SDK installation required to run Flax Editor."); LOG(Fatal, "Missing .NET 8 or later SDK installation required to run Flax Editor.");

View File

@@ -135,7 +135,7 @@ namespace Flax.Build
/// <summary> /// <summary>
/// The maximum SDK version. /// The maximum SDK version.
/// </summary> /// </summary>
public static Version MaximumVersion => new Version(8, 0); public static Version MaximumVersion => new Version(9, 0);
/// <inheritdoc /> /// <inheritdoc />
public override TargetPlatform[] Platforms public override TargetPlatform[] Platforms
@@ -166,10 +166,11 @@ namespace Flax.Build
/// </summary> /// </summary>
public string CSharpLanguageVersion => Version.Major switch public string CSharpLanguageVersion => Version.Major switch
{ {
8 => "12.0", _ when Version.Major >= 9 => "13.0",
7 => "11.0", _ when Version.Major >= 8 => "12.0",
6 => "10.0", _ when Version.Major >= 7 => "11.0",
5 => "9.0", _ when Version.Major >= 6 => "10.0",
_ when Version.Major >= 5 => "9.0",
_ => "7.3", _ => "7.3",
}; };