Converts the Launcher Service + Agent from net8/win-x64 self-contained to net48 framework-dependent, and makes Tesla.Contract net48-only (drops multi-targeting). Both consumers (Console + Launcher) are now a single TFM. Code changes for net48 (the only net8/netstandard2.1 APIs in use): - RandomNumberGenerator.Fill -> RandomNumberGenerator.Create().GetBytes (3x) - TcpListener.AcceptTcpClientAsync(ct) -> AcceptTcpClientAsync() + stop-on-cancel - byte[].AsSpan().SequenceEqual -> Linq SequenceEqual (no System.Memory) (2x) - PipeStream.Write(byte[]) / WriteAsync(byte[],ct) -> explicit (buf,0,len[,ct]) - Math.Clamp -> Math.Max/Min The generic host (Microsoft.Extensions.Hosting 8.x + UseWindowsService) runs on net48 unchanged. build.bat/install.bat updated for the folder-of-DLLs deploy; solution platform reverted x64 -> AnyCPU. RESULT — package size: ~3.7 MB on disk / 1.58 MB zipped, vs ~213 MB / 91 MB for the net8 self-contained build (~50-58x smaller). net48 ships in Win10/11 so no runtime prerequisite. 73 tests green; NOT re-validated on a live pod. Spike branch for evaluation — do not merge without a pod re-test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
131 lines
4.5 KiB
Batchfile
131 lines
4.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:
|
|
:: TeslaLauncher\
|
|
:: install.bat
|
|
:: Service\TeslaLauncherService.exe
|
|
:: Agent\TeslaLauncherAgent.exe
|
|
:: [oalinst.exe, dx9201006\] (if vendored under assets\)
|
|
::
|
|
:: 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
|
|
set BUILD_DIR=%ROOT%TeslaLauncher
|
|
|
|
:: -- 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 v0.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"
|
|
|
|
:: -- 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 --------------------------------------
|
|
if exist "%ROOT%install.bat" copy /y "%ROOT%install.bat" "%BUILD_DIR%\" >nul
|
|
if exist "%ROOT%assets\oalinst.exe" copy /y "%ROOT%assets\oalinst.exe" "%BUILD_DIR%\" >nul
|
|
if exist "%ROOT%assets\dx9201006\" xcopy /y /s /i /q "%ROOT%assets\dx9201006" "%BUILD_DIR%\dx9201006" >nul
|
|
|
|
:: -- 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 Next steps:
|
|
echo 1. Copy the TeslaLauncher\ folder to the pod (or stand-in) PC
|
|
echo 2. Run TeslaLauncher\install.bat as Administrator
|
|
echo.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 0
|