install.bat passes /loadinf="...\UltraVNC.inf", so the answer file must have the .inf extension. Also make build.bat wipe the dx9201006/openal/UltraVNC package folders before re-copying, so stale files don't linger across builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
148 lines
5.5 KiB
Batchfile
148 lines
5.5 KiB
Batchfile
@echo off
|
|
:: =============================================================================
|
|
:: TeslaLauncher — Unified Build / Package Script
|
|
:: =============================================================================
|
|
:: Publishes TeslaLauncherService.exe and TeslaLauncherAgent.exe as
|
|
:: framework-dependent net48 builds and assembles the installable TeslaLauncher\
|
|
:: package next to install.bat. The target pod needs .NET Framework 4.8 (built
|
|
:: into Windows 10/11) — there is no bundled runtime, so the package is small.
|
|
::
|
|
:: Requirements:
|
|
:: .NET SDK (6.0+) to drive the build https://dotnet.microsoft.com/download
|
|
:: Internet access for NuGet restore (first build only)
|
|
::
|
|
:: Usage:
|
|
:: build.bat - build both components + package
|
|
:: build.bat /service - build Service only
|
|
:: build.bat /agent - build Agent only
|
|
::
|
|
:: Output (under dist\, parity with Console\dist\):
|
|
:: dist\TeslaLauncher\
|
|
:: install.bat
|
|
:: Service\TeslaLauncherService.exe
|
|
:: Agent\TeslaLauncherAgent.exe
|
|
:: dx9201006\ openal\ UltraVNC\ (redist, mirrored from assets\)
|
|
:: dist\TeslaLauncher-podpkg.zip (the deployable package)
|
|
::
|
|
:: NOTE: the projects reference ..\Contract\Tesla.Contract.csproj, so they are
|
|
:: published IN PLACE (not staged into a temp folder) — the project reference
|
|
:: must be able to resolve relative to this directory.
|
|
:: =============================================================================
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
set ROOT=%~dp0
|
|
:: Package under dist\ (parity with Console\dist\).
|
|
set BUILD_DIR=%ROOT%dist\TeslaLauncher
|
|
set ZIP=%ROOT%dist\TeslaLauncher-podpkg.zip
|
|
|
|
:: -- Parse arguments ----------------------------------------------------------
|
|
set BUILD_SERVICE=1
|
|
set BUILD_AGENT=1
|
|
set QUIET=0
|
|
|
|
for %%a in (%*) do (
|
|
if /i "%%~a"=="/service" set BUILD_AGENT=0
|
|
if /i "%%~a"=="/agent" set BUILD_SERVICE=0
|
|
if /i "%%~a"=="/q" set QUIET=1
|
|
)
|
|
|
|
echo.
|
|
echo ============================================================
|
|
echo Tesla Launcher v4.11.4.1 - Build ^& Package (net48, framework-dependent)
|
|
echo Output : %BUILD_DIR%
|
|
echo ============================================================
|
|
echo.
|
|
|
|
:: -- Verify .NET SDK ----------------------------------------------------------
|
|
where dotnet >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo ERROR: dotnet not found.
|
|
echo Install the .NET 8 SDK from:
|
|
echo https://dotnet.microsoft.com/download/dotnet/8.0
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 1
|
|
)
|
|
for /f "tokens=*" %%v in ('dotnet --version 2^>^&1') do set SDK_VER=%%v
|
|
echo SDK : %SDK_VER%
|
|
echo.
|
|
|
|
:: -- Clean prior package output ----------------------------------------------
|
|
if exist "%BUILD_DIR%\Service" rmdir /s /q "%BUILD_DIR%\Service"
|
|
if exist "%BUILD_DIR%\Agent" rmdir /s /q "%BUILD_DIR%\Agent"
|
|
if exist "%BUILD_DIR%\dx9201006" rmdir /s /q "%BUILD_DIR%\dx9201006"
|
|
if exist "%BUILD_DIR%\openal" rmdir /s /q "%BUILD_DIR%\openal"
|
|
if exist "%BUILD_DIR%\UltraVNC" rmdir /s /q "%BUILD_DIR%\UltraVNC"
|
|
|
|
:: -- Build Service ------------------------------------------------------------
|
|
if %BUILD_SERVICE%==0 goto :skip_service
|
|
|
|
echo [1/2] Publishing TeslaLauncherService (Session 0 Windows Service)...
|
|
echo.
|
|
dotnet publish "%ROOT%TeslaLauncherService.csproj" ^
|
|
-c Release ^
|
|
-o "%BUILD_DIR%\Service"
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERROR: Service build failed.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 1
|
|
)
|
|
echo.
|
|
echo Service : %BUILD_DIR%\Service\TeslaLauncherService.exe
|
|
echo.
|
|
|
|
:skip_service
|
|
|
|
:: -- Build Agent --------------------------------------------------------------
|
|
if %BUILD_AGENT%==0 goto :skip_agent
|
|
|
|
if %BUILD_SERVICE%==1 (echo [2/2] Publishing TeslaLauncherAgent...) else (echo [1/1] Publishing TeslaLauncherAgent...)
|
|
echo.
|
|
dotnet publish "%ROOT%TeslaLauncherAgent.csproj" ^
|
|
-c Release ^
|
|
"-p:DefineConstants=WINFORMS" ^
|
|
-o "%BUILD_DIR%\Agent"
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERROR: Agent build failed.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 1
|
|
)
|
|
echo.
|
|
echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
|
|
echo.
|
|
|
|
:skip_agent
|
|
|
|
:: -- Copy shared assets into the package --------------------------------------
|
|
:: Mirror each redist folder under assets\ into the package root so install.bat's
|
|
:: paths (%ROOT%\dx9201006\, %ROOT%\openal\, %ROOT%\UltraVNC\) resolve.
|
|
if exist "%ROOT%install.bat" copy /y "%ROOT%install.bat" "%BUILD_DIR%\" >nul
|
|
if exist "%ROOT%assets\dx9201006" xcopy /y /s /i /q "%ROOT%assets\dx9201006" "%BUILD_DIR%\dx9201006" >nul
|
|
if exist "%ROOT%assets\openal" xcopy /y /s /i /q "%ROOT%assets\openal" "%BUILD_DIR%\openal" >nul
|
|
if exist "%ROOT%assets\UltraVNC" xcopy /y /s /i /q "%ROOT%assets\UltraVNC" "%BUILD_DIR%\UltraVNC" >nul
|
|
|
|
:: -- Zip the package ----------------------------------------------------------
|
|
echo Zipping package...
|
|
if exist "%ZIP%" del /q "%ZIP%"
|
|
powershell -NoProfile -Command "Compress-Archive -Path '%BUILD_DIR%' -DestinationPath '%ZIP%' -Force"
|
|
|
|
:: -- Summary ------------------------------------------------------------------
|
|
echo ============================================================
|
|
echo Build complete
|
|
echo ============================================================
|
|
echo.
|
|
if %BUILD_SERVICE%==1 echo Service : %BUILD_DIR%\Service\TeslaLauncherService.exe
|
|
if %BUILD_AGENT%==1 echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
|
|
echo.
|
|
echo Package : %BUILD_DIR%
|
|
echo Zip : %ZIP%
|
|
echo.
|
|
echo Next steps:
|
|
echo 1. Copy TeslaLauncher-podpkg.zip to the pod (or stand-in) PC and extract it
|
|
echo 2. Run TeslaLauncher\install.bat as Administrator
|
|
echo.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 0
|