From 9d7f01c29c06cd62b60c79961c03c225c621cd7b Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 18 Dec 2025 16:07:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8F=91=E5=B8=83=E8=84=9A=E6=9C=AC=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 release.bat 一键发布脚本 - 交互式版本号选择(保持/补丁+1/次版本+1/主版本+1/自定义) - 自动更新 csproj 和 setup.iss 中的版本号 - 自动编译、复制文件、生成安装包 - 更新 BUILD_INSTALLER.md 添加发布脚本使用说明 - 修复 轻量级订单发货客户端方案.md 中的 .NET 版本号(4.8 -> 4.6.2) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- BUILD_INSTALLER.md | 33 ++++- release.bat | 168 ++++++++++++++++++++++++ 轻量级订单发货客户端方案.md | 2 +- 3 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 release.bat diff --git a/BUILD_INSTALLER.md b/BUILD_INSTALLER.md index c26e04c..b727f32 100644 --- a/BUILD_INSTALLER.md +++ b/BUILD_INSTALLER.md @@ -8,7 +8,36 @@ - Windows 10(自带 .NET Framework 4.6.2+) - Windows 11(自带 .NET Framework 4.6.2+) -## 方式一:使用 Inno Setup 创建安装程序(推荐) +## 方式一:使用发布脚本(推荐) + +### 一键发布(含版本管理) + +双击运行 `release.bat`,按提示操作: + +``` +======================================== + PackagingMallShipper - Release Tool +======================================== + +[Info] Current version: 1.0.0 + +Options: + 1. Keep current version [1.0.0] + 2. Increment patch version (x.x.X) -> 1.0.1 + 3. Increment minor version (x.X.0) -> 1.1.0 + 4. Increment major version (X.0.0) -> 2.0.0 + 5. Enter custom version + +Select option [1-5]: +``` + +### 命令行指定版本 + +```cmd +release.bat 1.2.0 +``` + +## 方式二:使用 Inno Setup 手动编译 ### 步骤 1:安装 Inno Setup @@ -33,7 +62,7 @@ installer\PackagingMallShipper_Setup_v1.0.0.exe ``` -## 方式二:手动分发(无需安装程序) +## 方式三:手动分发(无需安装程序) 将 `publish` 文件夹的内容复制给用户: ``` diff --git a/release.bat b/release.bat new file mode 100644 index 0000000..2fada6c --- /dev/null +++ b/release.bat @@ -0,0 +1,168 @@ +@echo off +chcp 65001 >nul +setlocal EnableDelayedExpansion + +echo ======================================== +echo PackagingMallShipper - Release Tool +echo ======================================== +echo. + +:: 检查 Inno Setup +set "ISCC=" +if exist "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" ( + set "ISCC=C:\Program Files (x86)\Inno Setup 6\ISCC.exe" +) +if exist "C:\Program Files\Inno Setup 6\ISCC.exe" ( + set "ISCC=C:\Program Files\Inno Setup 6\ISCC.exe" +) + +if "%ISCC%"=="" ( + echo [Error] Inno Setup 6 not found + echo. + echo Please download and install Inno Setup 6: + echo https://jrsoftware.org/isdl.php + echo. + pause + exit /b 1 +) + +:: 读取当前版本号 +for /f "tokens=2 delims=<>" %%a in ('findstr /C:"" PackagingMallShipper\PackagingMallShipper.csproj') do ( + set "CURRENT_VERSION=%%a" +) + +echo [Info] Current version: %CURRENT_VERSION% +echo. + +:: 询问是否更新版本 +if "%1"=="" ( + echo Options: + echo 1. Keep current version [%CURRENT_VERSION%] + echo 2. Increment patch version (x.x.X) + echo 3. Increment minor version (x.X.0) + echo 4. Increment major version (X.0.0) + echo 5. Enter custom version + echo. + set /p "CHOICE=Select option [1-5]: " +) else ( + set "NEW_VERSION=%1" + goto :set_version +) + +if "%CHOICE%"=="1" ( + set "NEW_VERSION=%CURRENT_VERSION%" + goto :build +) + +if "%CHOICE%"=="2" ( + call :increment_patch %CURRENT_VERSION% + goto :set_version +) + +if "%CHOICE%"=="3" ( + call :increment_minor %CURRENT_VERSION% + goto :set_version +) + +if "%CHOICE%"=="4" ( + call :increment_major %CURRENT_VERSION% + goto :set_version +) + +if "%CHOICE%"=="5" ( + set /p "NEW_VERSION=Enter new version (e.g. 1.2.3): " + goto :set_version +) + +set "NEW_VERSION=%CURRENT_VERSION%" +goto :build + +:set_version +echo. +echo [Step 1] Updating version to %NEW_VERSION%... + +:: 更新 csproj 文件中的版本号 +powershell -Command "(Get-Content 'PackagingMallShipper\PackagingMallShipper.csproj') -replace '[0-9]+\.[0-9]+\.[0-9]+', '%NEW_VERSION%' -replace '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', '%NEW_VERSION%.0' -replace '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', '%NEW_VERSION%.0' | Set-Content 'PackagingMallShipper\PackagingMallShipper.csproj' -Encoding UTF8" + +:: 更新 setup.iss 文件中的版本号 +powershell -Command "(Get-Content 'setup.iss') -replace '#define MyAppVersion \"[0-9]+\.[0-9]+\.[0-9]+\"', '#define MyAppVersion \"%NEW_VERSION%\"' | Set-Content 'setup.iss' -Encoding UTF8" + +echo [Info] Version updated to %NEW_VERSION% +echo. + +:build +echo [Step 2] Building Release version... +dotnet build -c Release +if %ERRORLEVEL% NEQ 0 ( + echo [Error] Build failed! + pause + exit /b 1 +) +echo. + +echo [Step 3] Copying files to publish folder... +if not exist "publish" mkdir publish +if not exist "publish\x64" mkdir publish\x64 +if not exist "publish\x86" mkdir publish\x86 + +copy /Y "PackagingMallShipper\bin\Release\net462\PackagingMallShipper.exe" "publish\" >nul +copy /Y "PackagingMallShipper\bin\Release\net462\PackagingMallShipper.exe.config" "publish\" >nul +copy /Y "PackagingMallShipper\bin\Release\net462\x64\SQLite.Interop.dll" "publish\x64\" >nul +copy /Y "PackagingMallShipper\bin\Release\net462\x86\SQLite.Interop.dll" "publish\x86\" >nul + +if not exist "publish\PackagingMallShipper.exe" ( + echo [Error] publish\PackagingMallShipper.exe not found + echo. + pause + exit /b 1 +) +echo [Info] Files copied to publish folder +echo. + +echo [Step 4] Compiling installer... +echo. + +"%ISCC%" setup.iss + +if %ERRORLEVEL% EQU 0 ( + echo. + echo ======================================== + echo [Success] Release completed! + echo. + echo Version: %NEW_VERSION% + echo Installer: installer\PackagingMallShipper_Setup_v%NEW_VERSION%.exe + echo ======================================== + echo. + if exist "installer" explorer "installer" +) else ( + echo. + echo [Error] Installer compilation failed, error code: %ERRORLEVEL% +) + +pause +exit /b 0 + +:: ========================================== +:: Version increment functions +:: ========================================== + +:increment_patch +for /f "tokens=1,2,3 delims=." %%a in ("%1") do ( + set /a "PATCH=%%c+1" + set "NEW_VERSION=%%a.%%b.!PATCH!" +) +exit /b 0 + +:increment_minor +for /f "tokens=1,2,3 delims=." %%a in ("%1") do ( + set /a "MINOR=%%b+1" + set "NEW_VERSION=%%a.!MINOR!.0" +) +exit /b 0 + +:increment_major +for /f "tokens=1,2,3 delims=." %%a in ("%1") do ( + set /a "MAJOR=%%a+1" + set "NEW_VERSION=!MAJOR!.0.0" +) +exit /b 0 diff --git a/轻量级订单发货客户端方案.md b/轻量级订单发货客户端方案.md index 628bf31..e7626f9 100644 --- a/轻量级订单发货客户端方案.md +++ b/轻量级订单发货客户端方案.md @@ -1428,7 +1428,7 @@ public class ShipOrderRequest |-----|------|------| | 操作系统 | Windows 7 SP1+ | 开发和运行环境 | | IDE | Visual Studio 2019 | 社区版即可(免费) | -| .NET Framework | 4.8 | Win7 已内置 | +| .NET Framework | 4.6.2 | Win7 SP1 支持 | | 数据库 | SQLite | 自动创建,无需安装 | ### 8.2 Visual Studio 2019 安装