fix: 脚本统一用 pwsh 替代 powershell,MSTest adapter 动态查找

- 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 → 通配符动态查找
  (包升级后不再失效)
This commit is contained in:
tian 2026-08-02 20:41:18 +08:00
parent 8ee06586af
commit 488e69d27a
4 changed files with 13 additions and 6 deletions

View File

@ -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.

View File

@ -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

View File

@ -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" (

View File

@ -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