@echo off :: ============================================================================= :: TeslaLauncher - Unified Build / Package Script (XP11 single binary) :: ============================================================================= :: Publishes TeslaLauncher.exe as a framework-dependent net40 build and :: assembles the installable TeslaLauncher\ package next to install.bat. :: :: net40 is deliberate: it is the newest .NET Framework that installs on :: Windows XP SP3, and net40 assemblies run in-place on the 4.8 runtime built :: into Windows 10/11 - so this ONE exe covers XP SP3 through Windows 11. :: - XP SP3 pods additionally need the .NET Framework 4.0 redistributable :: (dotNetFx40_Full_x86_x64.exe); drop it into assets\dotnet40\ to have :: install.bat run it automatically when missing. :: - Windows 10/11 pods need nothing extra. :: :: 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 + package :: build.bat /q - no pause on exit :: :: Output (under dist\, parity with Console\dist\): :: dist\TeslaLauncher\ :: install.bat :: App\TeslaLauncher.exe (+ Newtonsoft.Json.dll, TeslaConsoleLaunchLib.dll) :: dx9201006\ openal\ UltraVNC\ dotnet40\ (redist, mirrored from assets\) :: dist\TeslaLauncher-podpkg.zip (the deployable package) :: :: NOTE: the project references ..\Contract\Tesla.Contract.csproj, so it is :: 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 set BUILD_DIR=%ROOT%dist\TeslaLauncher set ZIP=%ROOT%dist\TeslaLauncher-podpkg.zip set QUIET=0 for %%a in (%*) do ( if /i "%%~a"=="/q" set QUIET=1 ) echo. echo ============================================================ echo Tesla Launcher v4.11.4.3 - Build ^& Package (net40 single binary) 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%\App" rmdir /s /q "%BUILD_DIR%\App" 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" if exist "%BUILD_DIR%\dotnet40" rmdir /s /q "%BUILD_DIR%\dotnet40" :: -- Build -------------------------------------------------------------------- echo [1/1] Publishing TeslaLauncher (net40 single binary)... echo. dotnet publish "%ROOT%TeslaLauncher.csproj" ^ -c Release ^ -o "%BUILD_DIR%\App" if errorlevel 1 ( echo. echo ERROR: build failed. if "%QUIET%"=="0" pause exit /b 1 ) echo. echo Launcher : %BUILD_DIR%\App\TeslaLauncher.exe echo. :: -- Copy shared assets into the package -------------------------------------- :: Mirror each redist folder under assets\ into the package root so install.bat's :: paths (%ROOT%\dx9201006\ etc.) 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 if exist "%ROOT%assets\dotnet40" xcopy /y /s /i /q "%ROOT%assets\dotnet40" "%BUILD_DIR%\dotnet40" >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. echo Launcher : %BUILD_DIR%\App\TeslaLauncher.exe echo. echo Package : %BUILD_DIR% echo Zip : %ZIP% echo. echo Next steps: echo 1. Copy TeslaLauncher-podpkg.zip to the pod (XP SP3 or Win10/11) and extract echo 2. Run TeslaLauncher\install.bat as Administrator echo. if "%QUIET%"=="0" pause exit /b 0