fix: 修复 release.bat 版本号读取问题

- 切换到脚本所在目录确保路径正确
- 使用 type | findstr 替代直接 findstr 读取文件
- 添加版本号读取失败的错误处理

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Administrator
2025-12-18 16:57:09 +08:00
parent feca116163
commit 7aa7605ff5

View File

@@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 >nul 2>&1
setlocal EnableDelayedExpansion
echo ========================================
@@ -7,6 +7,9 @@ echo PackagingMallShipper - Release Tool
echo ========================================
echo.
:: 切换到脚本所在目录
cd /d "%~dp0"
:: 检查 Inno Setup
set "ISCC="
if exist "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" (
@@ -27,10 +30,18 @@ if "%ISCC%"=="" (
)
:: 读取当前版本号
for /f "tokens=2 delims=<>" %%a in ('findstr /C:"<Version>" PackagingMallShipper\PackagingMallShipper.csproj') do (
set "CURRENT_VERSION="
for /f "tokens=2 delims=<>" %%a in ('type "PackagingMallShipper\PackagingMallShipper.csproj" ^| findstr "<Version>"') do (
set "CURRENT_VERSION=%%a"
)
if "%CURRENT_VERSION%"=="" (
echo [Error] Could not read version from csproj file
echo.
pause
exit /b 1
)
echo [Info] Current version: %CURRENT_VERSION%
echo.