v2rayN/v2rayN/build-linux.sh
FlowerRealm 364aa56cd4 Add Linux build script and documentation
This PR adds a Linux build script (build-linux.sh) that allows building the v2rayN application on Linux systems. It also includes documentation (BUILD-LINUX.md) on how to use the script.

Note: The documentation needs to be manually migrated to the Wiki.
2025-09-24 14:03:07 +08:00

30 lines
No EOL
1 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# v2rayN Linux构建脚本仅生成可执行文件
set -e # 遇到错误时停止执行
# 还原NuGet包
echo "正在还原NuGet包..."
dotnet restore ./v2rayN.Desktop/v2rayN.Desktop.csproj
dotnet restore ./ServiceLib/ServiceLib.csproj
dotnet restore ./GlobalHotKeys/src/GlobalHotKeys/GlobalHotKeys.csproj
# 构建项目
echo "正在构建项目..."
dotnet build ./ServiceLib/ServiceLib.csproj --configuration Release
dotnet build ./GlobalHotKeys/src/GlobalHotKeys/GlobalHotKeys.csproj --configuration Release
dotnet build ./v2rayN.Desktop/v2rayN.Desktop.csproj --configuration Release
# 发布应用
echo "正在发布应用..."
OUTPUT_DIR="./publish"
mkdir -p $OUTPUT_DIR
# 发布Desktop版本仅生成可执行文件
echo "发布Desktop版本..."
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-x64 --self-contained true -o $OUTPUT_DIR/v2rayN-linux-64
echo "构建完成!"
echo "可执行文件位于: ./publish/v2rayN-linux-64/"
echo "直接运行: ./publish/v2rayN-linux-64/v2rayN"