diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a416c1a408..077ea3cd8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,17 +10,17 @@ permissions: jobs: linux: - name: Linux (.NET 6.0) + name: Linux (.NET 8.0) runs-on: ubuntu-22.04 steps: - name: Clone Repository uses: actions/checkout@v4 - - name: Install .NET 6.0 + - name: Install .NET 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Check Code run: | @@ -34,17 +34,17 @@ jobs: make TREAT_WARNINGS_AS_ERRORS=true test windows: - name: Windows (.NET 6.0) + name: Windows (.NET 8.0) runs-on: windows-2019 steps: - name: Clone Repository uses: actions/checkout@v4 - - name: Install .NET 6.0 + - name: Install .NET 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Check Code shell: powershell diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b04bc85eee..7b746b1b97 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -56,10 +56,10 @@ jobs: with: ref: ${{ needs.prepare.outputs.git_tag }} - - name: Install .NET 6 + - name: Install .NET 8 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Prepare Environment run: | @@ -111,10 +111,10 @@ jobs: with: ref: ${{ needs.prepare.outputs.git_tag }} - - name: Install .NET 6 + - name: Install .NET 8 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Prepare Environment run: | diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 2daeeff91a..7cf51fb708 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -42,10 +42,10 @@ jobs: - name: Clone Repository uses: actions/checkout@v4 - - name: Install .NET 6.0 + - name: Install .NET 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Prepare Environment run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV} @@ -72,10 +72,10 @@ jobs: - name: Clone Repository uses: actions/checkout@v4 - - name: Install .NET 6.0 + - name: Install .NET 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Prepare Environment run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV} @@ -107,10 +107,10 @@ jobs: - name: Clone Repository uses: actions/checkout@v4 - - name: Install .NET 6.0 + - name: Install .NET 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Prepare Environment run: | diff --git a/Directory.Build.props b/Directory.Build.props index 0d842c1842..2cf4ebd216 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -18,7 +18,7 @@ - net6.0 + net8.0 diff --git a/INSTALL.md b/INSTALL.md index 004d1c217b..9928249960 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,7 +8,7 @@ Windows Compiling OpenRA requires the following dependencies: * [Windows PowerShell >= 4.0](https://microsoft.com/powershell) (included by default in recent Windows 10 versions) -* [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) (or via Visual Studio) +* [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) (or via Visual Studio) To compile OpenRA, open the `OpenRA.sln` solution in the main folder, build it from the command-line with `dotnet` or use the Makefile analogue command `make all` scripted in PowerShell syntax. @@ -17,7 +17,7 @@ Run the game with `launch-game.cmd`. It can be handed arguments that specify the Linux ===== -.NET 6 is required to compile OpenRA. The [.NET 6 download page](https://dotnet.microsoft.com/download/dotnet/6.0) provides repositories for various package managers and binary releases for several architectures. +.NET 8 is required to compile OpenRA. The [.NET 8 download page](https://dotnet.microsoft.com/download/dotnet/8.0) provides repositories for various package managers and binary releases for several architectures. To compile OpenRA, run `make` from the command line. After this one can run the game with `./launch-game.sh`. It is also possible to specify the mod you wish to run from the command line, e.g. with `./launch-game.sh Game.Mod=ts` if you wish to try the experimental Tiberian Sun mod. @@ -76,6 +76,6 @@ Type `sudo make install` for system-wide installation. Run `sudo make install-li macOS ===== -[.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) is required to compile OpenRA. +[.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) is required to compile OpenRA. To compile OpenRA, run `make` from the command line. Run with `./launch-game.sh`. diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 996456cbef..a8a62a5ce2 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -16,7 +16,6 @@ using System.Globalization; using System.IO; using System.Linq; using System.Reflection; -using System.Runtime.Serialization; using OpenRA.Primitives; using OpenRA.Support; @@ -26,7 +25,6 @@ namespace OpenRA { const char SplitComma = ','; - [Serializable] public class MissingFieldsException : YamlException { public readonly string[] Missing; @@ -46,13 +44,6 @@ namespace OpenRA Header = missing.Length > 1 ? header : headerSingle ?? header; Missing = missing; } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("Missing", Missing); - info.AddValue("Header", Header); - } } public static Func InvalidValueAction = (s, t, f) => diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index 1237972726..d38e76e5af 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -16,7 +16,6 @@ using OpenRA.Primitives; namespace OpenRA.Graphics { - [Serializable] public class SheetOverflowException : Exception { public SheetOverflowException(string message) diff --git a/OpenRA.Game/Map/ActorReference.cs b/OpenRA.Game/Map/ActorReference.cs index e42483ba6c..55e1b078f4 100644 --- a/OpenRA.Game/Map/ActorReference.cs +++ b/OpenRA.Game/Map/ActorReference.cs @@ -14,7 +14,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.Serialization; +using System.Runtime.CompilerServices; using OpenRA.Primitives; using OpenRA.Traits; @@ -70,7 +70,7 @@ namespace OpenRA if (type == null) throw new InvalidDataException($"Unknown initializer type '{initInstance[0]}Init'"); - var init = (ActorInit)FormatterServices.GetUninitializedObject(type); + var init = (ActorInit)RuntimeHelpers.GetUninitializedObject(type); if (initInstance.Length > 1) type.GetField(nameof(ActorInit.InstanceName)).SetValue(init, initInstance[1]); diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index a737c5762a..2b534bc1ee 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -724,7 +724,6 @@ namespace OpenRA } } - [Serializable] public class YamlException : Exception { public YamlException(string s) diff --git a/OpenRA.Mods.Common/Commands/DevCommands.cs b/OpenRA.Mods.Common/Commands/DevCommands.cs index 291a9d2ce7..e5ca60b48a 100644 --- a/OpenRA.Mods.Common/Commands/DevCommands.cs +++ b/OpenRA.Mods.Common/Commands/DevCommands.cs @@ -254,7 +254,6 @@ namespace OpenRA.Mods.Common.Commands world.IssueOrder(new Order(command, world.LocalPlayer.PlayerActor, false)); } - [Serializable] public class DevException : Exception { } } } diff --git a/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs index 3b2abccc2f..e4a40d6c73 100644 --- a/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs @@ -13,7 +13,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using System.Runtime.Serialization; +using System.Runtime.CompilerServices; using Eluant; using OpenRA.Mods.Common.Traits; using OpenRA.Primitives; @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Scripting throw new LuaException($"Unknown initializer type '{initInstance[0]}'"); // Construct the ActorInit. - var init = (ActorInit)FormatterServices.GetUninitializedObject(initType); + var init = (ActorInit)RuntimeHelpers.GetUninitializedObject(initType); if (initInstance.Length > 1) initType.GetField(nameof(ActorInit.InstanceName)).SetValue(init, initInstance[1]); diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index 8c2e37db1b..f7abf5a36b 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -13,13 +13,11 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.Serialization; namespace OpenRA { using UtilityActions = Dictionary, Func>>; - [Serializable] public class NoSuchCommandException : Exception { public readonly string Command; @@ -28,12 +26,6 @@ namespace OpenRA { Command = command; } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("Command", Command); - } } sealed class Program diff --git a/packaging/functions.sh b/packaging/functions.sh index 2354b5e155..0629d39ceb 100644 --- a/packaging/functions.sh +++ b/packaging/functions.sh @@ -119,7 +119,7 @@ install_windows_launcher() ( # -p:DisplayName doesn't seem to have a visible effect? dotnet publish "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -c Release -r "${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}",TargetPlatform="${TARGETPLATFORM}",ModID="${MOD_ID}",PublishDir="${DEST_PATH}",FaqUrl="${FAQ_URL}",InformationalVersion="${VERSION}" --self-contained true - # NET 6 is unable to customize the application host for windows when compiling from Linux, + # NET 8 is unable to customize the application host for windows when compiling from Linux, # so we must patch the properties we need in the PE header. # Setting the application icon requires an external tool, so is left to the calling code python3 "${SRC_PATH}/packaging/windows/fixlauncher.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe" diff --git a/packaging/macos/apphost.c b/packaging/macos/apphost.c index 42e6793c7f..a2140b3c2d 100644 --- a/packaging/macos/apphost.c +++ b/packaging/macos/apphost.c @@ -11,7 +11,7 @@ // because macOS will only properly associate dock icons and tooltips to windows that are // created by a process in the Contents/MacOS directory (not subdirectories). // -// .NET 6 does not support universal binaries, and the apphost that is created when +// .NET 8 does not support universal binaries, and the apphost that is created when // publishing requires the runtime files to exist in the same directory as the launcher. // diff --git a/packaging/windows/buildpackage.sh b/packaging/windows/buildpackage.sh index a10c6a8ccf..e5b414db1d 100755 --- a/packaging/windows/buildpackage.sh +++ b/packaging/windows/buildpackage.sh @@ -54,7 +54,7 @@ function makelauncher() convert "${ARTWORK_DIR}/${MOD_ID}_16x16.png" "${ARTWORK_DIR}/${MOD_ID}_24x24.png" "${ARTWORK_DIR}/${MOD_ID}_32x32.png" "${ARTWORK_DIR}/${MOD_ID}_48x48.png" "${ARTWORK_DIR}/${MOD_ID}_256x256.png" "${BUILTDIR}/${MOD_ID}.ico" install_windows_launcher "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${LAUNCHER_NAME}" "${DISPLAY_NAME}" "${FAQ_URL}" "${TAG}" - # Use rcedit to patch the generated EXE with missing assembly/PortableExecutable information because .NET 6 ignores that when building on Linux. + # Use rcedit to patch the generated EXE with missing assembly/PortableExecutable information because .NET 8 ignores that when building on Linux. # Using a backwards version tag because rcedit is unable to set versions starting with a letter. wine64 rcedit-x64.exe "${BUILTDIR}/${LAUNCHER_NAME}.exe" --set-product-version "${BACKWARDS_TAG}" wine64 rcedit-x64.exe "${BUILTDIR}/${LAUNCHER_NAME}.exe" --set-version-string "ProductName" "OpenRA"