From 488e69d27a12d8530d09e683afb0d291dd01182e Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Sun, 2 Aug 2026 20:41:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=84=9A=E6=9C=AC=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=94=A8=20pwsh=20=E6=9B=BF=E4=BB=A3=20powershell=EF=BC=8CMSTe?= =?UTF-8?q?st=20adapter=20=E5=8A=A8=E6=80=81=E6=9F=A5=E6=89=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - start-navisworks.bat / run-ground-virtual-collision-test.bat: powershell → pwsh(避免依赖 shim/PS5.1,UTF-8 中文输出更可靠) - deploy-plugin.bat 提权兜底:PowerShell → pwsh(内外一致) - run-unit-tests.bat:MSTest adapter 路径硬编码 3.0.4 → 通配符动态查找 (包升级后不再失效) --- deploy-plugin.bat | 2 +- run-ground-virtual-collision-test.bat | 2 +- run-unit-tests.bat | 13 ++++++++++--- start-navisworks.bat | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/deploy-plugin.bat b/deploy-plugin.bat index 92538ad..7bdb221 100644 --- a/deploy-plugin.bat +++ b/deploy-plugin.bat @@ -19,7 +19,7 @@ if %ERRORLEVEL% EQU 0 ( REM Normal deploy failed. Elevate and retry. echo Deployment failed with current user permissions. Retrying with administrator rights... -PowerShell -Command "Start-Process -FilePath 'pwsh.exe' -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','\"%SCRIPT_DIR%deploy-body.ps1\"' -Verb RunAs -Wait" +pwsh -Command "Start-Process -FilePath 'pwsh.exe' -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','\"%SCRIPT_DIR%deploy-body.ps1\"' -Verb RunAs -Wait" if errorlevel 1 ( echo Deployment failed. diff --git a/run-ground-virtual-collision-test.bat b/run-ground-virtual-collision-test.bat index e38e421..5389e86 100644 --- a/run-ground-virtual-collision-test.bat +++ b/run-ground-virtual-collision-test.bat @@ -1,7 +1,7 @@ @echo off setlocal -powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\run-ground-virtual-collision-test.ps1" %* +pwsh -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\run-ground-virtual-collision-test.ps1" %* if errorlevel 1 exit /b 1 exit /b 0 diff --git a/run-unit-tests.bat b/run-unit-tests.bat index 64220ca..10bf1d8 100644 --- a/run-unit-tests.bat +++ b/run-unit-tests.bat @@ -21,11 +21,18 @@ if not exist %VSTEST_PATH% ( exit /b 1 ) -set TEST_ADAPTER_PATH="packages\MSTest.TestAdapter.3.0.4\build\net462" -if not exist %TEST_ADAPTER_PATH% ( - echo MSTest adapter path not found: %TEST_ADAPTER_PATH% +REM 动态查找 MSTest adapter(避免包版本升级后硬编码路径失效) +for /d %%d in ("packages\MSTest.TestAdapter.*") do set TEST_ADAPTER_BASE=%%~fd +if not defined TEST_ADAPTER_BASE ( + echo MSTest adapter package not found under packages\MSTest.TestAdapter.* exit /b 1 ) +set "TEST_ADAPTER_PATH=%TEST_ADAPTER_BASE%\build\net462" +if not exist "%TEST_ADAPTER_PATH%" ( + echo MSTest adapter net462 dir not found: %TEST_ADAPTER_PATH% + exit /b 1 +) +echo Using MSTest adapter: %TEST_ADAPTER_PATH% set NAVISWORKS_PATH=C:\Program Files\Autodesk\Navisworks Manage 2026 if not exist "%NAVISWORKS_PATH%\Autodesk.Navisworks.Api.dll" ( diff --git a/start-navisworks.bat b/start-navisworks.bat index fcffa3c..71775c0 100644 --- a/start-navisworks.bat +++ b/start-navisworks.bat @@ -1,7 +1,7 @@ @echo off setlocal -powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\start-navisworks.ps1" %* +pwsh -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\start-navisworks.ps1" %* if errorlevel 1 exit /b 1 exit /b 0