From 820619b0dcda5186e9638245cf08375fd8209534 Mon Sep 17 00:00:00 2001 From: Merijn Hendriks Date: Sat, 9 Dec 2023 16:32:45 +0000 Subject: [PATCH] [critical] Fix .NET Framework version (!42) ## Preface The current version of Aki uses .NET Framework 4.7.2, C# 7.3. However, this is not correct. Unity 2019.4.31f uses .NET Framework 4.7.1, C# 7.0 (you can see this when creating a new blank project in this unity version, then check the Assembly-CSharp.csproj). You can load netstandard2.0 assemblies into EFT, which support C# 7.3. ## The issue .NET Core 2.1 support types like `Span` and `ReadOnlySpan` which previous versions of .NET (.NET Core 2.0 / .NET Framework 4.8.1 and below, C# 7.1 and below) need to support through the `System.Memory` nuget package. Right now, this conflicts. If you attempt to load an assembly like this, EFT will simply crash because `Span` and `ReadOnlySpan` do not exist inside mono's `mscorlib`. ## Why fix this This is important for a variety of reasons: - Prevent modders from accessing not available APIs leading to unexpected crashes - Prevent possible compatability issues with EFT later - Support for `Span` and `ReadOnlySpan` through `System.Memory` which is important for high-performance code and client mods (one of which I'm working on). I really want to stress that this is an important issue to fix and should be merged ASAP. Unity 2019.4 being lax doesn't mean the next LTS version won't prevent loading. ## Why was the wrong version in the first place? It was a best guess made by me 2 years ago. There were more pressing issues back then and it didn't crash on me. It started becoming an issue 1 year ago when I tried to port Aki to C#, because self-signed certificate generation is supported only within 4.7.2 and newer. For reference: https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.certificaterequest.createselfsigned?view=netframework-4.7.2 ## What's affected? All the `.csproj` files in this repo. Merging this means that some mods might need to retarget from .NET Framework 4.7.2 to 4.7.1. Co-authored-by: Dev Co-authored-by: Terkoiz Co-authored-by: Terkoiz Co-authored-by: DanW Co-authored-by: Merijn Hendriks Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Modules/pulls/42 Co-authored-by: Merijn Hendriks Co-committed-by: Merijn Hendriks --- project/Aki.Build/Aki.Build.csproj | 2 +- project/Aki.Common/Aki.Common.csproj | 2 +- project/Aki.Core/Aki.Core.csproj | 2 +- project/Aki.Custom/Aki.Custom.csproj | 2 +- project/Aki.Debugging/Aki.Debugging.csproj | 2 +- project/Aki.PrePatch/Aki.PrePatch.csproj | 2 +- project/Aki.Reflection/Aki.Reflection.csproj | 2 +- project/Aki.SinglePlayer/Aki.SinglePlayer.csproj | 2 +- project/build.cake | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/project/Aki.Build/Aki.Build.csproj b/project/Aki.Build/Aki.Build.csproj index 079b874..5c1b1b5 100644 --- a/project/Aki.Build/Aki.Build.csproj +++ b/project/Aki.Build/Aki.Build.csproj @@ -1,7 +1,7 @@  - net472 + net471 diff --git a/project/Aki.Common/Aki.Common.csproj b/project/Aki.Common/Aki.Common.csproj index 690ee64..d23bb96 100644 --- a/project/Aki.Common/Aki.Common.csproj +++ b/project/Aki.Common/Aki.Common.csproj @@ -2,7 +2,7 @@ 1.0.0.0 - net472 + net471 diff --git a/project/Aki.Core/Aki.Core.csproj b/project/Aki.Core/Aki.Core.csproj index 6448701..7d7fd63 100644 --- a/project/Aki.Core/Aki.Core.csproj +++ b/project/Aki.Core/Aki.Core.csproj @@ -1,7 +1,7 @@  - net472 + net471 aki-core diff --git a/project/Aki.Custom/Aki.Custom.csproj b/project/Aki.Custom/Aki.Custom.csproj index 8e14130..174c36a 100644 --- a/project/Aki.Custom/Aki.Custom.csproj +++ b/project/Aki.Custom/Aki.Custom.csproj @@ -1,7 +1,7 @@  - net472 + net471 aki-custom diff --git a/project/Aki.Debugging/Aki.Debugging.csproj b/project/Aki.Debugging/Aki.Debugging.csproj index 3958538..d99956a 100644 --- a/project/Aki.Debugging/Aki.Debugging.csproj +++ b/project/Aki.Debugging/Aki.Debugging.csproj @@ -1,7 +1,7 @@  - net472 + net471 aki-debugging diff --git a/project/Aki.PrePatch/Aki.PrePatch.csproj b/project/Aki.PrePatch/Aki.PrePatch.csproj index 242f07a..d909db1 100644 --- a/project/Aki.PrePatch/Aki.PrePatch.csproj +++ b/project/Aki.PrePatch/Aki.PrePatch.csproj @@ -2,7 +2,7 @@ - net472 + net471 aki_PrePatch diff --git a/project/Aki.Reflection/Aki.Reflection.csproj b/project/Aki.Reflection/Aki.Reflection.csproj index e7dd073..fb08a82 100644 --- a/project/Aki.Reflection/Aki.Reflection.csproj +++ b/project/Aki.Reflection/Aki.Reflection.csproj @@ -1,7 +1,7 @@  - net472 + net471 diff --git a/project/Aki.SinglePlayer/Aki.SinglePlayer.csproj b/project/Aki.SinglePlayer/Aki.SinglePlayer.csproj index d1c4584..76bbd58 100644 --- a/project/Aki.SinglePlayer/Aki.SinglePlayer.csproj +++ b/project/Aki.SinglePlayer/Aki.SinglePlayer.csproj @@ -1,7 +1,7 @@  - net472 + net471 aki-singleplayer diff --git a/project/build.cake b/project/build.cake index 09b4e3f..46a72ed 100644 --- a/project/build.cake +++ b/project/build.cake @@ -68,7 +68,7 @@ Task("CopyBuildData") CreateDirectory(bepInExPatchersFolder); CopyFile(licenseFile, string.Format("{0}/LICENSE-Modules.txt", buildDir)); }) - .DoesForEach(GetFiles("./Aki.*/bin/Release/net472/*.dll"), (dllPath) => //copy modules + .DoesForEach(GetFiles("./Aki.*/bin/Release/net471/*.dll"), (dllPath) => //copy modules { if(dllPath.GetFilename().ToString().StartsWith("aki_")) {