From: js6pak Date: Sun, 18 Dec 2022 19:13:25 +0000 (+0100) Subject: Upgrade to net7.0 X-Git-Tag: v1.8.0~4^2~3 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=d5165a79f109a0a35ac18f600a77affb17bd104f;p=rhonda%2Fimpostor.git Upgrade to net7.0 --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91a2736..ab75f97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.x + dotnet-version: 7.x - name: Run the Cake script uses: cake-build/cake-action@v1 diff --git a/Dockerfile b/Dockerfile index d13c4f4..3ca0f2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build # See for all possible platforms # https://github.com/containerd/containerd/blob/master/platforms/platforms.go#L17 @@ -36,7 +36,7 @@ RUN case "$TARGETARCH" in \ dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" -p:VersionSuffix="$VERSIONSUFFIX" --no-restore ./src/Impostor.Server/Impostor.Server.csproj # Final image. -FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:6.0 +FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:7.0 WORKDIR /app COPY --from=build /app ./ EXPOSE 22023/udp diff --git a/docs/Building-from-source.md b/docs/Building-from-source.md index 708bd3f..2f4b98c 100644 --- a/docs/Building-from-source.md +++ b/docs/Building-from-source.md @@ -1,6 +1,6 @@ # Building from source -The solution contains the Impostor server and its dependencies, like Hazel and the plugin API. The server is built using [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0). +The solution contains the Impostor server and its dependencies, like Hazel and the plugin API. The server is built using [.NET 7](https://dotnet.microsoft.com/download/dotnet/7.0). ## Cloning Impostor @@ -14,7 +14,7 @@ git clone https://github.com/Impostor/Impostor.git ### Dependencies -- [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) +- [.NET 7 SDK](https://dotnet.microsoft.com/download/dotnet/7.0) - [Rider](https://www.jetbrains.com/rider/) or [Visual Studio](https://visualstudio.microsoft.com/vs/) (Optional, only if you want the full IDE experience) ### Build using the CLI diff --git a/docs/Running-the-server.md b/docs/Running-the-server.md index e96d9d5..56e5497 100644 --- a/docs/Running-the-server.md +++ b/docs/Running-the-server.md @@ -6,7 +6,7 @@ There are currently two modes to run the Impostor server. The first way, Single ### Without Docker -1. Install the [.NET 6.0 runtime](https://dotnet.microsoft.com/download/dotnet/6.0). Installing the SDK also works, but is not necessary unless you plan on developing Impostor or Impostor plugins. If you're asked to pick between the normal, desktop or server runtime, the normal runtime is enough, but some plugins may require the ASP.NET Core Runtime as well. +1. Install the [.NET 7.0 runtime](https://dotnet.microsoft.com/download/dotnet/7.0). Installing the SDK also works, but is not necessary unless you plan on developing Impostor or Impostor plugins. If you're asked to pick between the normal, desktop or server runtime, the normal runtime is enough, but some plugins may require the ASP.NET Core Runtime as well. 2. Find the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://nightly.link/Impostor/Impostor/workflows/ci/master). 3. Download the version for your OS (linux/win/osx). Impostor is built for multiple CPU-architectures, you most likely want the x64 version, unless you are running on a Raspberry Pi or another device with an ARM processor. 4. Extract the zip. diff --git a/docs/Writing-a-plugin.md b/docs/Writing-a-plugin.md index d40056e..e931709 100644 --- a/docs/Writing-a-plugin.md +++ b/docs/Writing-a-plugin.md @@ -27,23 +27,24 @@ https://dotnet.microsoft.com/download ## 2. Create a C# project -The first step is creating a new C# project, it must be a **Class Library (.NET Standard)**. The target framework can be any of those compatible with .NET 6, which includes: +The first step is creating a new C# project, it must be a **Class Library (.NET Standard)**. The target framework can be any of those compatible with .NET 7, which includes: - .NET Standard 2.0 - .NET Standard 2.1 - .NET 5 - .NET 6 +- .NET 7 For more information about compatibility, see https://docs.microsoft.com/en-us/dotnet/standard/net-standard. -> At the moment of writing this document, I recommend you to use **.NET Standard 2.1**. This should give you enough functionality. If not, upgrade to .NET 6. +> At the moment of writing this document, I recommend you to use **.NET 7.0**. When the project has been created, you should have `Class.cs` and `Project.csproj` files. Your `Project.csproj` should look something like this. ```xml - netstandard2.1 + net7.0 ``` @@ -269,7 +270,7 @@ Now your plugin is ready to be tested. 1. Right click your project and press `Build`. 2. Right click your project and press `Open Folder in File Explorer`. -3. Go to `bin/Debug/netstandard2.1/`. +3. Go to `bin/Debug/net7.0/`. 4. In this directory, you should find your plugin named `Project.dll`. 5. Copy the `Project.dll` to the `plugins` directory in your Impostor server directory. 6. (Re)start your Impostor server. @@ -309,7 +310,7 @@ Constantly copying the plugin dll to your server directory can be pretty annoyin }, "PluginLoader": { "Paths": [ - "D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\netstandard2.1" + "D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\net7.0" ], "LibraryPaths": [] } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index dea9033..044731e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,7 @@ - net6.0 + net7.0 + 11 1.7.3 dev true diff --git a/src/Impostor.Api/Impostor.Api.csproj b/src/Impostor.Api/Impostor.Api.csproj index a21ba48..9c7b0f2 100644 --- a/src/Impostor.Api/Impostor.Api.csproj +++ b/src/Impostor.Api/Impostor.Api.csproj @@ -1,9 +1,7 @@ - netstandard2.1 ../ProjectRules.ruleset - 9 true enable true @@ -27,16 +25,9 @@ - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + diff --git a/src/Impostor.Api/Innersloth/GameCodeParser.cs b/src/Impostor.Api/Innersloth/GameCodeParser.cs index f4743c5..583587c 100644 --- a/src/Impostor.Api/Innersloth/GameCodeParser.cs +++ b/src/Impostor.Api/Innersloth/GameCodeParser.cs @@ -12,8 +12,6 @@ namespace Impostor.Api.Innersloth private static readonly int[] V2Map = Enumerable.Range(65, 26).Select(v => V2.IndexOf((char)v)).ToArray(); - private static readonly RNGCryptoServiceProvider Random = new RNGCryptoServiceProvider(); - public static string IntToGameName(int input) { // V2. @@ -67,7 +65,7 @@ namespace Impostor.Api.Innersloth #else Span data = stackalloc byte[len]; #endif - Random.GetBytes(data); + RandomNumberGenerator.Fill(data); // Convert to their char representation. Span dataChar = stackalloc char[len]; diff --git a/src/Impostor.Benchmarks/Impostor.Benchmarks.csproj b/src/Impostor.Benchmarks/Impostor.Benchmarks.csproj index e747e83..11288b3 100644 --- a/src/Impostor.Benchmarks/Impostor.Benchmarks.csproj +++ b/src/Impostor.Benchmarks/Impostor.Benchmarks.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Impostor.Client.App/Impostor.Client.App.csproj b/src/Impostor.Client.App/Impostor.Client.App.csproj index fa708b1..fe5471d 100644 --- a/src/Impostor.Client.App/Impostor.Client.App.csproj +++ b/src/Impostor.Client.App/Impostor.Client.App.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Impostor.Plugins.Example/Impostor.Plugins.Example.csproj b/src/Impostor.Plugins.Example/Impostor.Plugins.Example.csproj index 2cfa53b..a6b5d40 100644 --- a/src/Impostor.Plugins.Example/Impostor.Plugins.Example.csproj +++ b/src/Impostor.Plugins.Example/Impostor.Plugins.Example.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net7.0 1.0.0 Example diff --git a/src/Impostor.Server/Impostor.Server.csproj b/src/Impostor.Server/Impostor.Server.csproj index f05e3c7..4bbb383 100644 --- a/src/Impostor.Server/Impostor.Server.csproj +++ b/src/Impostor.Server/Impostor.Server.csproj @@ -24,19 +24,17 @@ - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - diff --git a/src/Impostor.Tests/Impostor.Tests.csproj b/src/Impostor.Tests/Impostor.Tests.csproj index faa60d7..368281d 100644 --- a/src/Impostor.Tests/Impostor.Tests.csproj +++ b/src/Impostor.Tests/Impostor.Tests.csproj @@ -5,14 +5,14 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Impostor.Tools.Proxy/Impostor.Tools.Proxy.csproj b/src/Impostor.Tools.Proxy/Impostor.Tools.Proxy.csproj index 4e07db1..a626da1 100644 --- a/src/Impostor.Tools.Proxy/Impostor.Tools.Proxy.csproj +++ b/src/Impostor.Tools.Proxy/Impostor.Tools.Proxy.csproj @@ -5,7 +5,7 @@ - + NU1701 diff --git a/src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj b/src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj index becb742..66cd32a 100644 --- a/src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj +++ b/src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj @@ -9,7 +9,7 @@ - +