]> git.deb.at Git - rhonda/impostor.git/commitdiff
Upgrade to .NET 6 (#479)
authorminiduikboot <mini@duikbo.at>
Wed, 25 May 2022 17:52:22 +0000 (19:52 +0200)
committerGitHub <noreply@github.com>
Wed, 25 May 2022 17:52:22 +0000 (19:52 +0200)
* Upgrade to .NET 6

.NET 5 has gone EOL, so move to a supported version.

* Upgrade Docker container as well
* Update docs for .NET 6
* Re-add hack for System.IO.Pipelines
* Bump dependency versions
* Update the deps of the other projects too
* Only declare TargetFramework once
* Dockerfile: also copy over Directory.Build.props
* Cake: pick up target framework automatically
* Upgrade Cake as well

16 files changed:
.config/dotnet-tools.json
Dockerfile
build.cake
docs/Building-from-source.md
docs/Running-the-server.md
docs/Writing-a-plugin.md
src/Directory.Build.props
src/Impostor.Api/Impostor.Api.csproj
src/Impostor.Benchmarks/Impostor.Benchmarks.csproj
src/Impostor.Client.App/Impostor.Client.App.csproj
src/Impostor.Client/Impostor.Client.csproj
src/Impostor.Plugins.Debugger/Impostor.Plugins.Debugger.csproj
src/Impostor.Server/Impostor.Server.csproj
src/Impostor.Tests/Impostor.Tests.csproj
src/Impostor.Tools.Proxy/Impostor.Tools.Proxy.csproj
src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj

index 6cf141eb6c39100ecfbb5894969b17b0d0033947..7bd5f9f561cb646ce02526edb46dee3b0a39695c 100644 (file)
@@ -3,7 +3,7 @@
   "isRoot": true,
   "tools": {
     "cake.tool": {
-      "version": "1.1.0",
+      "version": "2.2.0",
       "commands": [
         "dotnet-cake"
       ]
index ae6b0706ee555f531004b895e99fff7b09f9e121..d13c4f41f445e8ba6036ddbe88928ab4d66469e6 100644 (file)
@@ -1,4 +1,4 @@
-FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:5.0 AS build
+FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 
 # See for all possible platforms
 # https://github.com/containerd/containerd/blob/master/platforms/platforms.go#L17
@@ -12,6 +12,7 @@ WORKDIR /source
 COPY src/Impostor.Server/Impostor.Server.csproj ./src/Impostor.Server/Impostor.Server.csproj
 COPY src/Impostor.Api/Impostor.Api.csproj ./src/Impostor.Api/Impostor.Api.csproj
 COPY src/Impostor.Hazel/Hazel/Hazel.csproj ./src/Impostor.Hazel/Hazel/Hazel.csproj
+COPY src/Directory.Build.props ./src/Directory.Build.props
 
 RUN case "$TARGETARCH" in \
     amd64)  NETCORE_PLATFORM='linux-x64';; \
@@ -35,8 +36,8 @@ 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:5.0
+FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:6.0
 WORKDIR /app
 COPY --from=build /app ./
 EXPOSE 22023/udp
-ENTRYPOINT ["./Impostor.Server"]
\ No newline at end of file
+ENTRYPOINT ["./Impostor.Server"]
index d99da2b8c644bc7a427b8fb6f4324ec34fe87079..67c06ab49b003f5c84053bafcc704d46d2cb0f43 100644 (file)
@@ -1,6 +1,6 @@
-#addin "nuget:?package=SharpZipLib&Version=1.3.1"
-#addin "nuget:?package=Cake.Compression&Version=0.2.6"
-#addin "nuget:?package=Cake.FileHelpers&Version=4.0.1"
+#addin "nuget:?package=SharpZipLib&Version=1.3.3"
+#addin "nuget:?package=Cake.Compression&Version=0.3.0"
+#addin "nuget:?package=Cake.FileHelpers&Version=5.0.0"
 
 var buildId = EnvironmentVariable("GITHUB_RUN_NUMBER") ?? EnvironmentVariable("APPVEYOR_BUILD_VERSION");
 var buildRelease = EnvironmentVariable("APPVEYOR_REPO_TAG") == "true";
@@ -10,7 +10,7 @@ var buildDir = MakeAbsolute(Directory("./build"));
 var target = Argument("target", "Deploy");
 var configuration = Argument("configuration", "Release");
 
-var msbuildSettings = new DotNetCoreMSBuildSettings();
+var msbuildSettings = new DotNetMSBuildSettings();
 
 if (buildRelease) 
 {
@@ -31,10 +31,9 @@ private void ImpostorPublish(string name, string project, string runtime, bool i
     var projBuildDir = buildDir.Combine(name + "_" + runtime);
     var projBuildName = name + "_" + buildVersion + "_" + runtime;
 
-    DotNetCorePublish(project, new DotNetCorePublishSettings {
+    DotNetPublish(project, new DotNetPublishSettings {
         Configuration = configuration,
         NoRestore = true,
-        Framework = "net5.0",
         Runtime = runtime,
         SelfContained = false,
         PublishSingleFile = true,
@@ -64,7 +63,7 @@ private void ImpostorPublishNF(string name, string project) {
     var projBuildDir = buildDir.Combine(name + "_" + runtime);
     var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip");
 
-    DotNetCorePublish(project, new DotNetCorePublishSettings {
+    DotNetPublish(project, new DotNetPublishSettings {
         Configuration = configuration,
         NoRestore = true,
         Framework = "net472",
@@ -90,18 +89,17 @@ Task("Clean")
 
 Task("Restore")
     .Does(() => {
-        DotNetCoreRestore("./src/Impostor.sln");
+        DotNetRestore("./src/Impostor.sln");
     });
 
 Task("Replay")
     .Does(() => {
         // D:\Projects\GitHub\Impostor\Impostor\src\Impostor.Tools.ServerReplay\sessions
-        DotNetCoreRun(
+        DotNetRun(
             "./src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj", 
-            "./src/Impostor.Tools.ServerReplay/sessions", new DotNetCoreRunSettings {
+            "./src/Impostor.Tools.ServerReplay/sessions", new DotNetRunSettings {
                 Configuration = configuration,
                 NoRestore = true,
-                Framework = "net5.0"
             });
     });
 
@@ -111,7 +109,7 @@ Task("Build")
     .IsDependentOn("Replay")
     .Does(() => {
         // Tests.
-        DotNetCoreBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreBuildSettings {
+        DotNetBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetBuildSettings {
             Configuration = configuration,
         });
             
@@ -123,7 +121,7 @@ Task("Build")
         ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm64", true);
 
         // API.
-        DotNetCorePack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetCorePackSettings {
+        DotNetPack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetPackSettings {
             Configuration = configuration,
             OutputDirectory = buildDir,
             IncludeSource = true,
@@ -135,7 +133,7 @@ Task("Build")
 Task("Test")
     .IsDependentOn("Build")
     .Does(() => {
-        DotNetCoreTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreTestSettings {
+        DotNetTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetTestSettings {
             Configuration = configuration,
             NoBuild = true
         });
@@ -151,4 +149,4 @@ Task("Deploy")
 // EXECUTION
 //////////////////////////////////////////////////////////////////////
 
-RunTarget(target);
\ No newline at end of file
+RunTarget(target);
index 1081c762cf4b38ebea87cc41fe479c2a8da17d26..708bd3f063ed3b776bc740d6878460e5e0167069 100644 (file)
@@ -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 5](https://dotnet.microsoft.com/download/dotnet/5.0).
+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).
 
 ## Cloning Impostor
 
@@ -14,7 +14,7 @@ git clone https://github.com/Impostor/Impostor.git
 
 ### Dependencies
 
-- [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0)
+- [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.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
index 7912f4f6041af8a8476bf88643fab2fb38d2712e..4ab0551b16cd74ca026d89e1753d1131da0189b2 100644 (file)
@@ -6,11 +6,11 @@ There are currently two modes to run the Impostor server. The first way, Single
 
 ### Without Docker
 
-1. Install the [.NET 5.0 runtime](https://dotnet.microsoft.com/download). 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 a console, desktop or server runtime, the console runtime is enough.
+1. Install the [.NET 6.0 runtime](https://dotnet.microsoft.com/download/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 a console, desktop or server runtime, the console runtime is enough.
 2. Find the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://ci.appveyor.com/project/Impostor/Impostor/branch/master/artifacts).
 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.
-5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md) *(this step is mandatory if you want to expose this server to other devices)*
+5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md) _(this step is mandatory if you want to expose this server to other devices)_
 6. Run `Impostor.Server` (Linux/macOS) or `Impostor.Server.exe` (Windows)
 
 ### Using Docker
index b487da1f91cd3bc334184ebb051aeba77b8b0fe9..d40056e890aa51424fe6add6e44f0bcb744c6d38 100644 (file)
@@ -19,23 +19,24 @@ Impostor has support for plugins. This document will help you to setup a develop
   - [Impostor versions](#impostor-versions)
 - [9. Missing/invalid data or want more functions?](#9-missinginvalid-data-or-want-more-functions)
 
-## 1. Install .NET Core SDK
+## 1. Install .NET SDK
 
-Download and install the latest .NET Core SDK.
+Download and install the latest .NET SDK.
 
 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 5, 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 6, which includes:
 
 - .NET Standard 2.0
 - .NET Standard 2.1
 - .NET 5
+- .NET 6
 
 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 5.
+> 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.
 
 When the project has been created, you should have `Class.cs` and `Project.csproj` files. Your `Project.csproj` should look something like this.
 
@@ -336,4 +337,4 @@ Create an issue:
 - [Suggest a function](https://github.com/Impostor/Impostor/issues/new?template=3--api-suggestion.md)
 - [Data is invalid](https://github.com/Impostor/Impostor/issues/new?template=4--api-invalid.md)
 - [Data is unavailable](https://github.com/Impostor/Impostor/issues/new?template=5--api-missing.md)
-- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
\ No newline at end of file
+- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
index 92f15b31d5a438b8134f825dc366fc94e415550b..8811525f5b3e4d0b48fe0b0f7d8e352de7abb287 100644 (file)
@@ -1,5 +1,6 @@
 <Project>
   <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
     <VersionPrefix>1.7.0</VersionPrefix>
     <VersionSuffix>dev</VersionSuffix>
     <EnforceCodeStyleInBuild Condition="$(MSBuildProjectName)!='Hazel'">true</EnforceCodeStyleInBuild>
index 4cd5e425fbdb286095753d59ac286cb4270eb369..a21ba48a5a8d1c8bc995ef649f4c032fe09ed442 100644 (file)
@@ -27,8 +27,8 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
-    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
+    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
     <PackageReference Include="Nullable" Version="1.3.0">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
index 6f19bda787036b1f6ae06f3943bacd7af49071d6..e747e831865d3e0a8977946aa8477cf06410ce93 100644 (file)
@@ -2,12 +2,11 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
+    <PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
   </ItemGroup>
 
   <ItemGroup>
index 3e5adc84ffd5f078b7b488a6b1714e1f1dc835cf..fa708b1880a4dcd831027f2b68f8860adf6a33bd 100644 (file)
@@ -2,7 +2,6 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
@@ -10,7 +9,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
+    <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
   </ItemGroup>
 
 </Project>
index 75e19aa8a6b293e6170f3831303cf79136ee6add..dee29e0829ae4b812aed705f2f44ddb7c444c8bc 100644 (file)
@@ -1,9 +1,5 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
-  <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
-  </PropertyGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\Impostor.Api\Impostor.Api.csproj" />
     <ProjectReference Include="..\Impostor.Hazel\Hazel\Hazel.csproj" />
index 2aa762518a27dfe374071b659e19060a39dd98ae..547835fe0b3d83a0b6d45644dbbd206c9f1cddfe 100644 (file)
@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
     <OutputType>Library</OutputType>
 
     <Version>1.0.0</Version>
index 49bb222cb8326797944e9b849f455b5b90be91ca..03ceb76f468aacd575786eedb7660be51f3e0656 100644 (file)
@@ -2,7 +2,6 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
     <RuntimeIdentifiers>win-x64;linux-x64;linux-arm;linux-arm64;osx-x64</RuntimeIdentifiers>
     <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
     <ApplicationIcon>icon.ico</ApplicationIcon>
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
-    <PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="5.0.0" />
-    <PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
-    <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.4" />
-    <PackageReference Include="Serilog.Extensions.Hosting" Version="4.1.2" />
-    <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
-    <PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.333">
+    <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.5" />
+    <PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
+    <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="6.0.5" />
+    <PackageReference Include="Serilog.Extensions.Hosting" Version="4.2.0" />
+    <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
+    <PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.435">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-    <!-- HACK: Some plugins depend on System.IO.Pipelines and expect the version to be 5.0.0.0, but .NET 5 only ships version 5.0.0.1. It is pretty hard to convince MSBuild to build against the correct DLL, so we special case it here. Remove once we move past .NET 5 -->
-    <PackageReference Include="System.IO.Pipelines" Version="5.0.0" />
+    <!-- HACK: Some plugins depend on System.IO.Pipelines and expect the version to be 6.0.0.0, but Hazel still depends on version 5.0.0.0. Figure out why this happens. -->
+    <PackageReference Include="System.IO.Pipelines" Version="6.0.0" />
   </ItemGroup>
 
   <ItemGroup>
index a4ccd6bf62ad222c16ef1c60e0960dd6d6089099..faa60d7264a4f684f30b9a9bc5e2ba648d6c208d 100644 (file)
@@ -1,16 +1,18 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
     <IsPackable>false</IsPackable>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
     <PackageReference Include="xunit" Version="2.4.1" />
     <PackageReference Include="xunit.runner.reporters" Version="2.4.1" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
-    <PackageReference Include="coverlet.collector" Version="3.0.3">
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+    <PackageReference Include="coverlet.collector" Version="3.1.2">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
index 11360170f4b44446d75312eda555b1b440e359b9..4e07db1e2f328426eabcdf64d2e3edf97430add9 100644 (file)
@@ -2,11 +2,10 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
+    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
     <PackageReference Include="Pcap.Net.x64" Version="1.0.4.1">
       <NoWarn>NU1701</NoWarn>
     </PackageReference>
index 3b46f3f87bd352e61cfedc1af0a4f222ab3cc899..becb7429cd62b9289287958aeaa437e918c16d99 100644 (file)
@@ -2,7 +2,6 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
@@ -10,7 +9,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
+    <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
   </ItemGroup>
 
 </Project>