From 06ad316f94ac636a0791887c4a50626eac98f9a4 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 26 Nov 2023 15:09:46 +0100 Subject: [PATCH] Update to .NET 8 --- .github/workflows/build_android.yml | 4 +-- .github/workflows/build_ios.yml | 4 +-- .github/workflows/build_linux.yml | 8 +++--- .github/workflows/build_mac.yml | 8 +++--- .github/workflows/build_windows.yml | 8 +++--- .github/workflows/cd.yml | 12 ++++---- .github/workflows/tests.yml | 22 +++++++-------- PackageAll.bat | 2 +- PackageEditor.bat | 2 +- PackageEditor.command | 2 +- PackageEditor.sh | 2 +- PackagePlatforms.bat | 2 +- PackagePlatforms.command | 2 +- PackagePlatforms.sh | 2 +- README.md | 12 ++++---- Source/Editor/Cooker/CookingData.h | 2 +- Source/Editor/Cooker/Steps/DeployDataStep.cpp | 16 +++++------ Source/Engine/Scripting/Runtime/DotNet.cpp | 6 ++-- .../FlaxEngine.CSharp.runtimeconfig.json | 4 +-- .../Flax.Build.Tests/Flax.Build.Tests.csproj | 2 +- .../Flax.Build/Build/DotNet/DotNetSdk.cs | 2 +- .../Build/NativeCpp/Builder.NativeCpp.cs | 28 +++++++++++++++++-- .../Flax.Build/Deps/Dependencies/nethost.cs | 4 +-- Source/Tools/Flax.Build/Flax.Build.csproj | 2 +- .../VisualStudio/CSSDKProjectGenerator.cs | 2 +- Source/Tools/Flax.Build/global.json | 2 +- global.json | 2 +- 27 files changed, 94 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index b0d4633a8..772e3f67c 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup .NET Workload run: | dotnet workload install android @@ -33,4 +33,4 @@ jobs: git lfs pull - name: Build run: | - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=7 -arch=ARM64 -platform=Android -configuration=Release -buildtargets=FlaxGame + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=8 -arch=ARM64 -platform=Android -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index 2aec46320..5a0d285fe 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup .NET Workload run: | dotnet workload install ios @@ -33,4 +33,4 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=7 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame + ./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=8 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 56accba84..b3348c288 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -25,7 +25,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -36,7 +36,7 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor # Game game-linux: @@ -53,7 +53,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -64,4 +64,4 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_mac.yml b/.github/workflows/build_mac.yml index 54bdb77b5..139bf2416 100644 --- a/.github/workflows/build_mac.yml +++ b/.github/workflows/build_mac.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -30,7 +30,7 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor + ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor # Game game-mac: @@ -44,7 +44,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -55,4 +55,4 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Mac -configuration=Release -buildtargets=FlaxGame + ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Mac -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index b6131fb53..85f4e0c79 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -30,7 +30,7 @@ jobs: git lfs pull - name: Build run: | - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor # Game game-windows: @@ -44,7 +44,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -55,4 +55,4 @@ jobs: git lfs pull - name: Build run: | - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a5d8bc043..70f275eac 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -26,7 +26,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -59,7 +59,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -95,7 +95,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -129,7 +129,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -159,7 +159,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -187,7 +187,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a524bdca2..e36642cdf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -34,21 +34,21 @@ jobs: sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev - name: Build run: | - ./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=7 - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=7 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget + ./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=8 + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget dotnet msbuild Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo dotnet msbuild Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo - name: Test run: | ${GITHUB_WORKSPACE}/Binaries/Editor/Linux/Development/FlaxTests - dotnet test -f net7.0 Binaries/Tests/Flax.Build.Tests.dll + dotnet test -f net8.0 Binaries/Tests/Flax.Build.Tests.dll cp Binaries/Editor/Linux/Development/FlaxEngine.CSharp.dll Binaries/Tests cp Binaries/Editor/Linux/Development/FlaxEngine.CSharp.runtimeconfig.json Binaries/Tests cp Binaries/Editor/Linux/Development/Newtonsoft.Json.dll Binaries/Tests - dotnet test -f net7.0 Binaries/Tests/FlaxEngine.CSharp.dll + dotnet test -f net8.0 Binaries/Tests/FlaxEngine.CSharp.dll - name: Test UseLargeWorlds run: | - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=7 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget -UseLargeWorlds=true + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget -UseLargeWorlds=true ${GITHUB_WORKSPACE}/Binaries/Editor/Linux/Development/FlaxTests # Tests on Windows @@ -61,7 +61,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Print .NET info run: | dotnet --info @@ -72,14 +72,14 @@ jobs: git lfs pull - name: Build run: | - .\GenerateProjectFiles.bat -vs2022 -log -verbose -printSDKs -dotnet=7 - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -dotnet=7 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxTestsTarget + .\GenerateProjectFiles.bat -vs2022 -log -verbose -printSDKs -dotnet=8 + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -dotnet=8 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxTestsTarget dotnet msbuild Source\Tools\Flax.Build.Tests\Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo - name: Test run: | .\Binaries\Editor\Win64\Development\FlaxTests.exe - dotnet test -f net7.0 Binaries\Tests\Flax.Build.Tests.dll + dotnet test -f net8.0 Binaries\Tests\Flax.Build.Tests.dll xcopy /y Binaries\Editor\Win64\Development\FlaxEngine.CSharp.dll Binaries\Tests xcopy /y Binaries\Editor\Win64\Development\FlaxEngine.CSharp.runtimeconfig.json Binaries\Tests xcopy /y Binaries\Editor\Win64\Development\Newtonsoft.Json.dll Binaries\Tests - dotnet test -f net7.0 Binaries\Tests\FlaxEngine.CSharp.dll + dotnet test -f net8.0 Binaries\Tests\FlaxEngine.CSharp.dll diff --git a/PackageAll.bat b/PackageAll.bat index 0325f2244..bfe9bce27 100644 --- a/PackageAll.bat +++ b/PackageAll.bat @@ -7,7 +7,7 @@ pushd echo Performing the full package... rem Run the build tool. -call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -deployPlatforms -dotnet=7 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* +call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -deployPlatforms -dotnet=8 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* if errorlevel 1 goto BuildToolFailed popd diff --git a/PackageEditor.bat b/PackageEditor.bat index 515b81871..be01a59b9 100644 --- a/PackageEditor.bat +++ b/PackageEditor.bat @@ -7,7 +7,7 @@ pushd echo Building and packaging Flax Editor... rem Run the build tool. -call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -dotnet=7 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* +call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -dotnet=8 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* if errorlevel 1 goto BuildToolFailed popd diff --git a/PackageEditor.command b/PackageEditor.command index eb62ae1a4..4e0ff71a1 100755 --- a/PackageEditor.command +++ b/PackageEditor.command @@ -9,4 +9,4 @@ echo Building and packaging Flax Editor... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployEditor --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployEditor --dotnet=8 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackageEditor.sh b/PackageEditor.sh index 151147b6a..819e101c4 100755 --- a/PackageEditor.sh +++ b/PackageEditor.sh @@ -9,4 +9,4 @@ echo Building and packaging Flax Editor... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployEditor --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployEditor --dotnet=8 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackagePlatforms.bat b/PackagePlatforms.bat index eb9c42d34..81cbad20b 100644 --- a/PackagePlatforms.bat +++ b/PackagePlatforms.bat @@ -7,7 +7,7 @@ pushd echo Building and packaging platforms data... rem Run the build tool. -call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployPlatforms -dotnet=7 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* +call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployPlatforms -dotnet=8 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* if errorlevel 1 goto BuildToolFailed popd diff --git a/PackagePlatforms.command b/PackagePlatforms.command index e9182a627..8950981e9 100755 --- a/PackagePlatforms.command +++ b/PackagePlatforms.command @@ -9,4 +9,4 @@ echo Building and packaging platforms data... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployPlatforms --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployPlatforms --dotnet=8 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackagePlatforms.sh b/PackagePlatforms.sh index f7e43cc42..c8e5609f5 100755 --- a/PackagePlatforms.sh +++ b/PackagePlatforms.sh @@ -9,4 +9,4 @@ echo Building and packaging platforms data... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployPlatforms --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployPlatforms --dotnet=8 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/README.md b/README.md index d6688bd03..1b0d06bf6 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Follow the instructions below to compile and run the engine from source. * Install Visual Studio 2022 or newer * Install Windows 8.1 SDK or newer (via Visual Studio Installer) * Install Microsoft Visual C++ 2015 v140 toolset or newer (via Visual Studio Installer) -* Install .NET 7 SDK for **Windows x64** (via Visual Studio Installer or [from web](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)) +* Install .NET 8 SDK for **Windows x64** (via Visual Studio Installer or [from web](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)) * Install Git with LFS * Clone repo (with LFS) * Run **GenerateProjectFiles.bat** @@ -44,8 +44,8 @@ Follow the instructions below to compile and run the engine from source. ## Linux * Install Visual Studio Code -* Install .NET 7 SDK ([https://dotnet.microsoft.com/en-us/download/dotnet/7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)) - * Ubuntu: `sudo apt install dotnet-sdk-7.0` +* Install .NET 8 SDK ([https://dotnet.microsoft.com/en-us/download/dotnet/8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)) + * Ubuntu: `sudo apt install dotnet-sdk-8.0` * Install Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/)) * Ubuntu: `sudo apt install vulkan-sdk` * Arch: `sudo pacman -S spirv-tools vulkan-headers vulkan-tools vulkan-validation-layers` @@ -67,7 +67,7 @@ Follow the instructions below to compile and run the engine from source. ## Mac * Install XCode -* Install .NET 7 SDK ([https://dotnet.microsoft.com/en-us/download/dotnet/7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)) +* Install .NET 8 SDK ([https://dotnet.microsoft.com/en-us/download/dotnet/8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)) * Install Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/)) * Clone repo (with LFS) * Run `GenerateProjectFiles.command` @@ -80,9 +80,9 @@ Follow the instructions below to compile and run the engine from source. Restart PC - ensure DotNet is added to PATH for command line tools execution. -* `Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 7.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 7.0` +* `Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 8.0` -Use Visual Studio 2022, older versions are not supported by .NET SDK 7. +Use Visual Studio 2022, older versions are not supported by .NET SDK 8. * `Building for Windows without Vulkan rendering backend (Vulkan SDK is missing)` diff --git a/Source/Editor/Cooker/CookingData.h b/Source/Editor/Cooker/CookingData.h index 1924b0c56..e4c071e8b 100644 --- a/Source/Editor/Cooker/CookingData.h +++ b/Source/Editor/Cooker/CookingData.h @@ -14,7 +14,7 @@ class PlatformTools; #if OFFICIAL_BUILD // Use the fixed .NET SDK version in packaged builds for compatibility (FlaxGame is precompiled with it) -#define GAME_BUILD_DOTNET_VER TEXT("-dotnet=7") +#define GAME_BUILD_DOTNET_VER TEXT("-dotnet=8") #else #define GAME_BUILD_DOTNET_VER TEXT("") #endif diff --git a/Source/Editor/Cooker/Steps/DeployDataStep.cpp b/Source/Editor/Cooker/Steps/DeployDataStep.cpp index c1179c77a..845651bed 100644 --- a/Source/Editor/Cooker/Steps/DeployDataStep.cpp +++ b/Source/Editor/Cooker/Steps/DeployDataStep.cpp @@ -116,7 +116,7 @@ bool DeployDataStep::Perform(CookingData& data) for (String& version : versions) { version = String(StringUtils::GetFileName(version)); - if (!version.StartsWith(TEXT("7."))) + if (!version.StartsWith(TEXT("8."))) // Check for major part of 8.0 version.Clear(); } Sorting::QuickSort(versions.Get(), versions.Count()); @@ -198,14 +198,14 @@ bool DeployDataStep::Perform(CookingData& data) { // AOT runtime files inside Engine Platform folder packFolder /= TEXT("Dotnet"); - dstDotnetLibs /= TEXT("lib/net7.0"); - srcDotnetLibs = packFolder / TEXT("lib/net7.0"); + dstDotnetLibs /= TEXT("lib/net8.0"); + srcDotnetLibs = packFolder / TEXT("lib/net8.0"); } else { // Runtime files inside Dotnet SDK folder but placed for AOT - dstDotnetLibs /= TEXT("lib/net7.0"); - srcDotnetLibs /= TEXT("../lib/net7.0"); + dstDotnetLibs /= TEXT("lib/net8.0"); + srcDotnetLibs /= TEXT("../lib/net8.0"); } } else @@ -213,14 +213,14 @@ bool DeployDataStep::Perform(CookingData& data) if (srcDotnetFromEngine) { // Runtime files inside Engine Platform folder - dstDotnetLibs /= TEXT("lib/net7.0"); - srcDotnetLibs /= TEXT("lib/net7.0"); + dstDotnetLibs /= TEXT("lib/net8.0"); + srcDotnetLibs /= TEXT("lib/net8.0"); } else { // Runtime files inside Dotnet SDK folder dstDotnetLibs /= TEXT("shared/Microsoft.NETCore.App"); - srcDotnetLibs /= TEXT("../lib/net7.0"); + srcDotnetLibs /= TEXT("../lib/net8.0"); } } FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.txt")); diff --git a/Source/Engine/Scripting/Runtime/DotNet.cpp b/Source/Engine/Scripting/Runtime/DotNet.cpp index 8d564ef6a..3774c0452 100644 --- a/Source/Engine/Scripting/Runtime/DotNet.cpp +++ b/Source/Engine/Scripting/Runtime/DotNet.cpp @@ -1704,12 +1704,12 @@ bool InitHostfxr() // Warn user about missing .Net #if PLATFORM_DESKTOP - Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet/7.0")); + Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet/8.0")); #endif #if USE_EDITOR - LOG(Fatal, "Missing .NET 7 or later SDK installation required to run Flax Editor."); + LOG(Fatal, "Missing .NET 8 or later SDK installation required to run Flax Editor."); #else - LOG(Fatal, "Missing .NET 7 or later Runtime installation required to run this application."); + LOG(Fatal, "Missing .NET 8 or later Runtime installation required to run this application."); #endif return true; } diff --git a/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json b/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json index 134a0ef98..f34374fb7 100644 --- a/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json +++ b/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json @@ -1,9 +1,9 @@ { "runtimeOptions": { - "tfm": "net7.0", + "tfm": "net8.0", "framework": { "name": "Microsoft.NETCore.App", - "version": "7.0.0", + "version": "8.0.0", "rollForward": "latestMajor" } } diff --git a/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj b/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj index df3b9851b..873f916c4 100644 --- a/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj +++ b/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 11.0 disable annotations diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index 240c95c16..b1fa7d446 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -130,7 +130,7 @@ namespace Flax.Build /// /// The minimum SDK version. /// - public static Version MinimumVersion => new Version(7, 0); + public static Version MinimumVersion => new Version(8, 0); /// /// The maximum SDK version. diff --git a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs index f6df4068e..f2146c82a 100644 --- a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs +++ b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs @@ -164,6 +164,30 @@ namespace Flax.Build } } + public string Serialize() + { + // Null any empty fields to exclude them from serialization + if (HotReloadPostfix?.Length == 0) + HotReloadPostfix = null; + foreach (var binaryModule in BinaryModules) + { + if (binaryModule.NativePathProcessed?.Length == 0) + binaryModule.NativePathProcessed = null; + if (binaryModule.ManagedPathProcessed?.Length == 0) + binaryModule.ManagedPathProcessed = null; + } + + // Convert to Json + var options = new JsonSerializerOptions + { + WriteIndented = true, + IncludeFields = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + TypeInfoResolver = BuildTargetInfoSourceGenerationContext.Default, + }; + return JsonSerializer.Serialize(this, options); + } + public static string ProcessPath(string path, string projectPath) { if (string.IsNullOrEmpty(path)) @@ -1017,7 +1041,7 @@ namespace Flax.Build buildData.BuildInfo.AddReferencedBuilds(ref i, project.ProjectFolderPath, buildData.ReferenceBuilds); if (!buildData.Target.IsPreBuilt) - Utilities.WriteFileIfChanged(Path.Combine(outputPath, target.Name + ".Build.json"), JsonSerializer.Serialize(buildData.BuildInfo, new JsonSerializerOptions() { WriteIndented = true, IncludeFields = true, TypeInfoResolver = BuildTargetInfoSourceGenerationContext.Default })); + Utilities.WriteFileIfChanged(Path.Combine(outputPath, target.Name + ".Build.json"), buildData.BuildInfo.Serialize()); } // Deploy files @@ -1216,7 +1240,7 @@ namespace Flax.Build buildData.BuildInfo.AddReferencedBuilds(ref i, project.ProjectFolderPath, buildData.ReferenceBuilds); if (!buildData.Target.IsPreBuilt) - Utilities.WriteFileIfChanged(Path.Combine(outputPath, target.Name + ".Build.json"), JsonSerializer.Serialize(buildData.BuildInfo, new JsonSerializerOptions() { WriteIndented = true, IncludeFields = true, TypeInfoResolver = BuildTargetInfoSourceGenerationContext.Default })); + Utilities.WriteFileIfChanged(Path.Combine(outputPath, target.Name + ".Build.json"), buildData.BuildInfo.Serialize()); } // Deploy files diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/nethost.cs b/Source/Tools/Flax.Build/Deps/Dependencies/nethost.cs index df808a063..1fcbb6ded 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/nethost.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/nethost.cs @@ -50,7 +50,7 @@ namespace Flax.Deps.Dependencies { // Build configuration (see build.cmd -help) string configuration = "Release"; - string framework = "net7.0"; + string framework = "net8.0"; // Clean output directory var artifacts = Path.Combine(root, "artifacts"); @@ -224,7 +224,7 @@ namespace Flax.Deps.Dependencies } var privateCorelib = "System.Private.CoreLib.dll"; Utilities.FileCopy(Path.Combine(unpackTemp, "runtimes", hostRuntimeName, "native", privateCorelib), Path.Combine(dstClassLibrary, privateCorelib)); - Utilities.DirectoryCopy(Path.Combine(unpackTemp, "runtimes", hostRuntimeName, "lib", "net7.0"), dstClassLibrary, false, true); + Utilities.DirectoryCopy(Path.Combine(unpackTemp, "runtimes", hostRuntimeName, "lib", "net8.0"), dstClassLibrary, false, true); // TODO: host/fxr//hostfxr.dll // TODO: shared/Microsoft.NETCore.App//hostpolicy.dl // TODO: shared/Microsoft.NETCore.App//System.IO.Compression.Native.dll diff --git a/Source/Tools/Flax.Build/Flax.Build.csproj b/Source/Tools/Flax.Build/Flax.Build.csproj index 9c837ee89..abce85366 100644 --- a/Source/Tools/Flax.Build/Flax.Build.csproj +++ b/Source/Tools/Flax.Build/Flax.Build.csproj @@ -1,7 +1,7 @@  Exe - net7.0 + net8.0 11.0 disable annotations diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs index 77b7abf46..63fade299 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs @@ -96,7 +96,7 @@ namespace Flax.Build.Projects.VisualStudio var cacheProjectsPath = Utilities.MakePathRelativeTo(Path.Combine(Globals.Root, "Cache", "Projects"), projectDirectory); var flaxBuildTargetsPath = !string.IsNullOrEmpty(cacheProjectsPath) ? Path.Combine(cacheProjectsPath, flaxBuildTargetsFilename) : flaxBuildTargetsFilename; - csProjectFileContent.AppendLine(" net7.0"); + csProjectFileContent.AppendLine(" net8.0"); csProjectFileContent.AppendLine(" disable"); csProjectFileContent.AppendLine(string.Format(" {0}", baseConfiguration.TargetBuildOptions.ScriptingAPI.CSharpNullableReferences.ToString().ToLowerInvariant())); csProjectFileContent.AppendLine(" false"); diff --git a/Source/Tools/Flax.Build/global.json b/Source/Tools/Flax.Build/global.json index 3fe9e80f6..9498eeef6 100644 --- a/Source/Tools/Flax.Build/global.json +++ b/Source/Tools/Flax.Build/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.0", + "version": "8.0.0", "rollForward": "latestMajor" } } \ No newline at end of file diff --git a/global.json b/global.json index 3fe9e80f6..9498eeef6 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.0", + "version": "8.0.0", "rollForward": "latestMajor" } } \ No newline at end of file