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:
15
release.bat
15
release.bat
@@ -1,5 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 >nul
|
chcp 65001 >nul 2>&1
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
echo ========================================
|
echo ========================================
|
||||||
@@ -7,6 +7,9 @@ echo PackagingMallShipper - Release Tool
|
|||||||
echo ========================================
|
echo ========================================
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
:: 切换到脚本所在目录
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
:: 检查 Inno Setup
|
:: 检查 Inno Setup
|
||||||
set "ISCC="
|
set "ISCC="
|
||||||
if exist "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" (
|
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"
|
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 [Info] Current version: %CURRENT_VERSION%
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user