From 3db599e90130c497fa369aa617b212b50cb6654a Mon Sep 17 00:00:00 2001 From: chylex Date: Tue, 18 Jul 2023 15:53:40 +0200 Subject: [PATCH] Update to .NET 8 --- README.md | 4 ++-- app/Desktop/Desktop.csproj | 1 - app/Desktop/Main/AboutWindow.axaml | 2 +- app/Directory.build.props | 8 ++++++++ app/Server/Server.csproj | 1 - app/Utils/Collections/LinqExtensions.cs | 5 ----- app/Utils/Utils.csproj | 1 - app/build.bat | 2 +- app/build.sh | 2 +- app/global.json | 2 +- web/index.php | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 app/Directory.build.props diff --git a/README.md b/README.md index 5fd5f14..9bc3a16 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Folder organization: * `lib/` contains utilities required to build the project * `web/` contains source code of the [official website](https://dht.chylex.com), which can be used as a template when making your own website -To start editing source code for the desktop app, install the [.NET 5 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/5.0), and then open `app/DiscordHistoryTracker.sln` in [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [Rider](https://www.jetbrains.com/rider/). +To start editing source code for the desktop app, install the [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0), and then open `app/DiscordHistoryTracker.sln` in [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [Rider](https://www.jetbrains.com/rider/). ### Building @@ -50,6 +50,6 @@ Run the `app/build.sh` script, and read the [Distribution](#distribution) sectio #### Distribution -The mentioned build scripts will prepare `Release` builds ready for distribution. Once the script finishes, the `app/bin` folder will contain self-contained executables for each major operating system, and a portable version that works on all other systems but requires .NET 5 to be installed. +The mentioned build scripts will prepare `Release` builds ready for distribution. Once the script finishes, the `app/bin` folder will contain self-contained executables for each major operating system, and a portable version that works on all other systems but requires .NET 8 to be installed. Note that when building on Windows, the generated `.zip` files for Linux and Mac will not have correct file permissions, so it will not be possible to run them by double-clicking `DiscordHistoryTracker`. I tried using Python to re-create the archives with correct file permissions, but found that Linux `zip` tools could not see them. The only working solution is building the Windows + portable version on Windows, and Linux + Mac version on Linux. diff --git a/app/Desktop/Desktop.csproj b/app/Desktop/Desktop.csproj index 32a6ead..f9a5e56 100644 --- a/app/Desktop/Desktop.csproj +++ b/app/Desktop/Desktop.csproj @@ -1,7 +1,6 @@  WinExe - net5.0 enable DiscordHistoryTracker DHT.Desktop diff --git a/app/Desktop/Main/AboutWindow.axaml b/app/Desktop/Main/AboutWindow.axaml index f9711ec..95f8326 100644 --- a/app/Desktop/Main/AboutWindow.axaml +++ b/app/Desktop/Main/AboutWindow.axaml @@ -46,7 +46,7 @@ License Link - .NET 5 + .NET 8 MIT diff --git a/app/Directory.build.props b/app/Directory.build.props new file mode 100644 index 0000000..b8611d8 --- /dev/null +++ b/app/Directory.build.props @@ -0,0 +1,8 @@ + + + + net8.0 + 11 + + + diff --git a/app/Server/Server.csproj b/app/Server/Server.csproj index 722a0da..57bb5b1 100644 --- a/app/Server/Server.csproj +++ b/app/Server/Server.csproj @@ -1,6 +1,5 @@ - net5.0 DHT.Server enable DiscordHistoryTracker.Server diff --git a/app/Utils/Collections/LinqExtensions.cs b/app/Utils/Collections/LinqExtensions.cs index 3d6416f..c9b5173 100644 --- a/app/Utils/Collections/LinqExtensions.cs +++ b/app/Utils/Collections/LinqExtensions.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; namespace DHT.Utils.Collections { public static class LinqExtensions { @@ -15,9 +14,5 @@ namespace DHT.Utils.Collections { } } } - - public static Dictionary ToDictionary(this IEnumerable<(TKey, TValue)> collection) where TKey : notnull { - return collection.ToDictionary(static item => item.Item1, static item => item.Item2); - } } } diff --git a/app/Utils/Utils.csproj b/app/Utils/Utils.csproj index f9f934c..a46b9dd 100644 --- a/app/Utils/Utils.csproj +++ b/app/Utils/Utils.csproj @@ -1,6 +1,5 @@ - net5.0 DHT.Utils enable DiscordHistoryTracker.Utils diff --git a/app/build.bat b/app/build.bat index c472fde..6c70463 100644 --- a/app/build.bat +++ b/app/build.bat @@ -4,7 +4,7 @@ set list=win-x64 linux-x64 osx-x64 rmdir /S /Q bin (for %%a in (%list%) do ( - dotnet publish Desktop -c Release -r %%a -o ./bin/%%a -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -p:PublishTrimmed=true --self-contained true + dotnet publish Desktop -c Release -r %%a -o ./bin/%%a -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -p:PublishTrimmed=true -p:TrimMode=partial --self-contained true powershell "Compress-Archive -Path ./bin/%%a/* -DestinationPath ./bin/%%a.zip -CompressionLevel Optimal" )) diff --git a/app/build.sh b/app/build.sh index 12cfa28..8ad8c05 100755 --- a/app/build.sh +++ b/app/build.sh @@ -17,7 +17,7 @@ rm -rf "./bin" configurations=(win-x64 linux-x64 osx-x64) for cfg in ${configurations[@]}; do - dotnet publish Desktop -c Release -r "$cfg" -o "./bin/$cfg" -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -p:PublishTrimmed=true --self-contained true + dotnet publish Desktop -c Release -r "$cfg" -o "./bin/$cfg" -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -p:PublishTrimmed=true -p:TrimMode=partial --self-contained true makezip "$cfg" done diff --git a/app/global.json b/app/global.json index a48ad76..dbf2988 100644 --- a/app/global.json +++ b/app/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.0", + "version": "8.0.0", "rollForward": "latestMinor" } } diff --git a/web/index.php b/web/index.php index 2dd53f4..33095e9 100644 --- a/web/index.php +++ b/web/index.php @@ -57,7 +57,7 @@ define('LATEST_VERSION', $version === false ? '_' : $version);

To launch the three OS-specific versions, extract the DiscordHistoryTracker executable, and double-click it.

-

To launch the Other version, which works on other operating systems including 32-bit versions, you must install ASP.NET Core Runtime 5. Then extract the downloaded archive into a folder, open the folder in a terminal, and type: dotnet DiscordHistoryTracker.dll

+

To launch the Other version, which works on other operating systems including 32-bit versions, you must install ASP.NET Core Runtime 8. Then extract the downloaded archive into a folder, open the folder in a terminal, and type: dotnet DiscordHistoryTracker.dll

How to Track Messages

The app saves messages into a database file stored on your computer. When you open the app, you are given the option to create a new database file, or open an existing one.