diff --git a/README.md b/README.md
index ae16803..e9702e2 100644
--- a/README.md
+++ b/README.md
@@ -28,18 +28,18 @@ To build a `Release` version of the desktop app, follow the instructions for you
#### Release – Windows (64-bit)
-1. Install [Powershell 5](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows) or newer (on Windows 10, the included version of Powershell should be enough)
+1. Install Debian in WSL and open a terminal in the project folder.
+2. Run the `app/build.wsl.sh` script.
+3. Read the [Distribution](#distribution) section below.
-Run the `app/build.bat` script, and read the [Distribution](#distribution) section below.
+Note: The build script expects `dotnet.exe` to be installed in `C:\Program Files\dotnet`.
#### Release – Other Operating Systems
-1. Install the `zip` package from your repository
-
-Run the `app/build.sh` script, and read the [Distribution](#distribution) section below.
+1. Install the `zip` package from your repository.
+2. Run the `app/build.sh` script.
+3. Read the [Distribution](#distribution) section below.
#### 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 the ASP.NET Core Runtime 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 the executable. Since .NET 8 fixed several issues with publishing Windows executables on Linux, I recommend using Linux to build the app for all operating systems.
diff --git a/app/Directory.Build.props b/app/Directory.Build.props
index 84cb153..d0fe8c5 100644
--- a/app/Directory.Build.props
+++ b/app/Directory.Build.props
@@ -39,6 +39,7 @@
false
none
+ true
diff --git a/app/build.bat b/app/build.bat
deleted file mode 100644
index 17f3371..0000000
--- a/app/build.bat
+++ /dev/null
@@ -1,15 +0,0 @@
-@echo off
-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 --self-contained true
- powershell "Compress-Archive -Path ./bin/%%a/* -DestinationPath ./bin/%%a.zip -CompressionLevel Optimal"
-))
-
-dotnet publish Desktop -c Release -o ./bin/portable -p:PublishSingleFile=false -p:PublishTrimmed=false --self-contained false
-powershell "Compress-Archive -Path ./bin/portable/* -DestinationPath ./bin/portable.zip -CompressionLevel Optimal"
-
-echo Done
-pause
diff --git a/app/build.sh b/app/build.sh
index efe2f4a..717f929 100755
--- a/app/build.sh
+++ b/app/build.sh
@@ -1,25 +1,38 @@
#!/bin/bash
set -e
+export TZ=UTC
+
if [ ! -f "DiscordHistoryTracker.sln" ]; then
- echo "Missing DiscordHistoryTracker.sln in working directory!"
- exit 1
+ echo "Missing DiscordHistoryTracker.sln in working directory!"
+ exit 1
fi
makezip() {
- pushd "./bin/$1"
- zip -9 -r "../$1.zip" .
- popd
+ BIN_PATH="$(pwd)/bin"
+
+ pushd "$BIN_PATH/$1"
+
+ find . -type d -exec chmod 755 {} \;
+ find . -type f -exec chmod 644 {} \;
+
+ chmod -f 755 DiscordHistoryTracker || true
+ chmod -f 755 DiscordHistoryTracker.exe || true
+
+ find . -type f | sort | zip -9 -X "$BIN_PATH/$1.zip" -@
+
+ popd
}
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" --self-contained true
- makezip "$cfg"
+for cfg in "${configurations[@]}"; do
+ dotnet publish Desktop -c Release -r "$cfg" -o "./bin/$cfg" --self-contained true
+ makezip "$cfg"
done
dotnet publish Desktop -c Release -o "./bin/portable" -p:PublishSingleFile=false -p:PublishTrimmed=false --self-contained false
+rm "./bin/portable/DiscordHistoryTracker"
makezip "portable"
diff --git a/app/build.wsl.sh b/app/build.wsl.sh
new file mode 100644
index 0000000..cfaebca
--- /dev/null
+++ b/app/build.wsl.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+set -e
+
+export TZ=UTC
+
+if [ ! -f "DiscordHistoryTracker.sln" ]; then
+ echo "Missing DiscordHistoryTracker.sln in working directory!"
+ exit 1
+fi
+
+makezip() {
+ TMP_PATH="/tmp/dht-build"
+ BIN_PATH="$(pwd)/bin"
+
+ rm -rf "$TMP_PATH"
+ cp -r "$BIN_PATH/$1/" "$TMP_PATH"
+ pushd "$TMP_PATH"
+
+ find . -type d -exec chmod 755 {} \;
+ find . -type f -exec chmod 644 {} \;
+
+ chmod -f 755 DiscordHistoryTracker || true
+ chmod -f 755 DiscordHistoryTracker.exe || true
+
+ find . -type f | sort | zip -9 -X "$BIN_PATH/$1.zip" -@
+
+ popd
+ rm -rf "$TMP_PATH"
+}
+
+rm -rf "./bin"
+
+configurations=(win-x64 linux-x64 osx-x64)
+
+for cfg in "${configurations[@]}"; do
+ "/mnt/c/Program Files/dotnet/dotnet.exe" publish Desktop -c Release -r "$cfg" -o "./bin/$cfg" --self-contained true
+ makezip "$cfg"
+done
+
+"/mnt/c/Program Files/dotnet/dotnet.exe" publish Desktop -c Release -o "./bin/portable" -p:PublishSingleFile=false -p:PublishTrimmed=false --self-contained false
+rm "./bin/portable/DiscordHistoryTracker.exe"
+makezip "portable"