Fix Launcher packaging for net8/x64; doc + gitignore updates

build.bat was broken by the contract extraction: it staged the loose Launcher
.cs files into temp folders and published from there, but the projects now have
a ProjectReference to ..\Contract\Tesla.Contract.csproj which cannot resolve from
a temp dir. Publish the projects IN PLACE instead, and target net8 / win-x64
(self-contained single-file) to match the runtime/arch uplift. The resulting
TeslaLauncher\ package (Service\ + Agent\ + install.bat) installs on a pod with
no .NET runtime prerequisite.

- Launcher/README.md: correct net6->net8, x86->x64, BinaryFormatter->framed JSON,
  and note wire types now come from ../Contract.
- Launcher/.gitignore: ignore the TeslaLauncher-*.zip deployment package.
- Console/.gitignore: ignore the published TeslaConsole-app\ package + its zip
  (framework-dependent net48 console build for running against a test pod).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-06-30 08:30:13 -05:00
co-authored by Claude Opus 4.8
parent b9d8027cf6
commit a7aafaa9e9
4 changed files with 69 additions and 107 deletions
+4
View File
@@ -2,6 +2,10 @@
[Bb]in/
[Oo]bj/
# Packaged runnable console (dotnet publish output) + its zip
/TeslaConsole-app/
/TeslaConsole-app*.zip
# IDE / OS
.vs/
.vscode/
+2
View File
@@ -7,6 +7,8 @@
/_stage_svc/
/_stage_agt/
/TeslaLauncher/
# zipped deployment package produced for transfer to a pod
/TeslaLauncher-*.zip
# ── Runtime / installer state ────────────────────────────────────────────────
# Generated by installutil / the service at runtime, not source
+26 -17
View File
@@ -1,6 +1,6 @@
# TeslaLauncher
.NET 6 rewrite of the original Elsewhen Studios LLC software (Windows 2000 / .NET Framework 2.0).
.NET 8 (win-x64, self-contained) rewrite of the original Elsewhen Studios LLC software (Windows 2000 / .NET Framework 2.0).
## Architecture
@@ -8,7 +8,7 @@ TeslaLauncher has three components that work together:
### TeslaLauncherService (Windows Service, Session 0)
- Runs at boot before any user logs in
- Listens on **TCP 53290** for OFB-encrypted BinaryFormatter RPC from TeslaConsole
- Listens on **TCP 53290** for OFB-encrypted framed-JSON RPC from TeslaConsole
- Forwards commands to the Agent via Named Pipe (`TeslaLauncherIPC`)
- Handles first-boot network configuration (SecureConfig)
- Handles game file transfers from the Console (InstallProduct)
@@ -29,12 +29,12 @@ TeslaLauncher has three components that work together:
## Communication Flow
```
TeslaConsole ──TCP 53290 (OFB + BinaryFormatter)──> TeslaLauncherService
Named Pipe (JSON)
v
TeslaLauncherAgent
TeslaConsole ──TCP 53290 (OFB + framed JSON)──> TeslaLauncherService
Named Pipe (JSON)
v
TeslaLauncherAgent
```
## Files
@@ -42,10 +42,10 @@ TeslaConsole ──TCP 53290 (OFB + BinaryFormatter)──> TeslaLauncherService
| File | Description |
|------|-------------|
| `TeslaLauncherService.cs` | Windows Service implementation |
| `TeslaLauncherService.csproj` | Service project (net6.0-windows, x86, self-contained) |
| `TeslaLauncherService.csproj` | Service project (net8.0-windows, x64, self-contained) |
| `TeslaLauncherAgent.cs` | Userspace Agent implementation |
| `TeslaLauncherAgent.csproj` | Agent project (WinForms, net6.0-windows, x86) |
| `LaunchModels_Shared.cs` | Wire types (Tesla.Net) and IPC types (Tesla.Launcher.Shared) |
| `TeslaLauncherAgent.csproj` | Agent project (WinForms, net8.0-windows, x64) |
| `LaunchModels_Shared.cs` | Service↔Agent IPC types (Tesla.Launcher.Shared). Wire types (Tesla.Net) now come from `../Contract/Tesla.Contract.csproj` |
| `SecureConfig.cs` | First-boot secure configuration protocol |
| `build.bat` | Builds both components |
| `install.bat` | Installs on a cockpit PC (run as Administrator) |
@@ -53,16 +53,19 @@ TeslaConsole ──TCP 53290 (OFB + BinaryFormatter)──> TeslaLauncherService
## Building
Requirements:
- .NET 6 SDK
- Internet access for NuGet restore
- .NET 8 SDK
- Internet access for NuGet restore (first build only)
```
build.bat :: build both components
build.bat :: build both components + assemble the package
build.bat /service :: build Service only
build.bat /agent :: build Agent only
```
Output goes to `TeslaLauncher\` with `Service\` and `Agent\` subdirectories.
Output goes to `TeslaLauncher\` with `Service\` and `Agent\` subdirectories plus
`install.bat`. The projects are published in place (self-contained, single-file,
win-x64) — they reference `../Contract`, so they cannot be staged into a temp
folder. No .NET runtime is required on the target pod.
## Installation
@@ -105,6 +108,12 @@ The Console connects to each configured pod on TCP 53290 and can:
## Wire Protocol
The Console uses BinaryFormatter over OFB-encrypted TCP streams. All types in the `Tesla.Net` namespace are exact replicas of the original structs from `TeslaConsoleLaunchLib.dll` to maintain serialization compatibility.
The Console talks to the Service with **length-prefixed System.Text.Json frames**
over the OFB-encrypted TCP stream (dispatch by method name) — see
`../Contract/PodRpcProtocol.cs`, shared by both ends. This replaced the original
`BinaryFormatter` + serialized-`MethodBase` scheme. The `Tesla.Net` wire types now
live in `../Contract/Tesla.Contract.csproj`, the single source of truth shared with
the Console.
The Service-to-Agent IPC uses length-prefixed JSON over a Named Pipe, with flat types that avoid the nested struct layout of the wire format.
The Service-to-Agent IPC uses length-prefixed JSON over a Named Pipe, with flat types
that avoid the nested struct layout of the wire format.
+37 -90
View File
@@ -1,36 +1,39 @@
@echo off
:: =============================================================================
:: TeslaLauncher — Unified Build Script
:: TeslaLauncher — Unified Build / Package Script
:: =============================================================================
:: Builds TeslaLauncherService.exe and TeslaLauncherAgent.exe (with integrated
:: TeslaSecureConfiguration protocol) from source.
:: Publishes TeslaLauncherService.exe and TeslaLauncherAgent.exe as
:: self-contained single-file win-x64 executables (net8) and assembles the
:: installable TeslaLauncher\ package next to install.bat.
::
:: Requirements:
:: .NET 6 SDK https://dotnet.microsoft.com/download/dotnet/6.0
:: Internet access for NuGet restore (System.IO.Ports 7.0.0)
:: .NET 8 SDK https://dotnet.microsoft.com/download/dotnet/8.0
:: Internet access for NuGet restore (first build only)
::
:: Usage:
:: build.bat build both components
:: build.bat /service build Service only
:: build.bat /agent build Agent only
:: build.bat - build both components + package
:: build.bat /service - build Service only
:: build.bat /agent - build Agent only
::
:: Output:
:: TeslaLauncher\
:: Service\
:: TeslaLauncherService.exe
:: Agent\
:: TeslaLauncherAgent.exe
:: 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
set SVC_STAGE=%ROOT%_stage_svc
set AGT_STAGE=%ROOT%_stage_agt
set RID=win-x64
:: ── Parse arguments ───────────────────────────────────────────────────────────
:: -- Parse arguments ----------------------------------------------------------
set BUILD_SERVICE=1
set BUILD_AGENT=1
set QUIET=0
@@ -43,17 +46,17 @@ for %%a in (%*) do (
echo.
echo ============================================================
echo Tesla Launcher v0.1 — Unified Build
echo Tesla Launcher v0.1 - Build ^& Package (net8, %RID%)
echo Output : %BUILD_DIR%
echo ============================================================
echo.
:: ── Verify .NET SDK ───────────────────────────────────────────────────────────
:: -- Verify .NET SDK ----------------------------------------------------------
where dotnet >nul 2>&1
if errorlevel 1 (
echo ERROR: dotnet not found.
echo Install the .NET 6 SDK from:
echo https://dotnet.microsoft.com/download/dotnet/6.0
echo Install the .NET 8 SDK from:
echo https://dotnet.microsoft.com/download/dotnet/8.0
if "%QUIET%"=="0" pause
exit /b 1
)
@@ -61,99 +64,63 @@ for /f "tokens=*" %%v in ('dotnet --version 2^>^&1') do set SDK_VER=%%v
echo SDK : %SDK_VER%
echo.
:: ── Verify source files ───────────────────────────────────────────────────────
call :check_file "TeslaLauncherService.cs" || goto :err_missing
call :check_file "TeslaLauncherService.csproj" || goto :err_missing
call :check_file "TeslaLauncherAgent.cs" || goto :err_missing
call :check_file "TeslaLauncherAgent.csproj" || goto :err_missing
call :check_file "LaunchModels_Shared.cs" || goto :err_missing
call :check_file "SecureConfig.cs" || goto :err_missing
:: ── Clean and prepare build output ───────────────────────────────────────────
:: -- 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 ─────────────────────────────────────────────────────────────
:: -- Build Service ------------------------------------------------------------
if %BUILD_SERVICE%==0 goto :skip_service
echo [1/2] Building TeslaLauncherService...
echo [1/2] Publishing TeslaLauncherService (Session 0 Windows Service)...
echo.
if exist "%SVC_STAGE%" rmdir /s /q "%SVC_STAGE%"
mkdir "%SVC_STAGE%"
copy /y "%ROOT%TeslaLauncherService.cs" "%SVC_STAGE%\" >nul
copy /y "%ROOT%TeslaLauncherService.csproj" "%SVC_STAGE%\" >nul
copy /y "%ROOT%LaunchModels_Shared.cs" "%SVC_STAGE%\" >nul
copy /y "%ROOT%SecureConfig.cs" "%SVC_STAGE%\" >nul
copy /y "%ROOT%app.ico" "%SVC_STAGE%\" >nul
dotnet publish "%SVC_STAGE%\TeslaLauncherService.csproj" ^
dotnet publish "%ROOT%TeslaLauncherService.csproj" ^
-c Release ^
-r win-x86 ^
-r %RID% ^
--self-contained true ^
-p:PublishSingleFile=true ^
-o "%BUILD_DIR%\Service"
if errorlevel 1 (
echo.
echo ERROR: Service build failed.
rmdir /s /q "%SVC_STAGE%" 2>nul
if "%QUIET%"=="0" pause
exit /b 1
)
rmdir /s /q "%SVC_STAGE%"
echo.
echo Service : %BUILD_DIR%\Service\TeslaLauncherService.exe
echo.
:skip_service
:: ── Build Agent ───────────────────────────────────────────────────────────────
:: -- Build Agent --------------------------------------------------------------
if %BUILD_AGENT%==0 goto :skip_agent
if %BUILD_SERVICE%==1 (echo [2/2] Building TeslaLauncherAgent...) else (echo [1/1] Building TeslaLauncherAgent...)
if %BUILD_SERVICE%==1 (echo [2/2] Publishing TeslaLauncherAgent...) else (echo [1/1] Publishing TeslaLauncherAgent...)
echo.
if exist "%AGT_STAGE%" rmdir /s /q "%AGT_STAGE%"
mkdir "%AGT_STAGE%"
copy /y "%ROOT%TeslaLauncherAgent.cs" "%AGT_STAGE%\" >nul
copy /y "%ROOT%TeslaLauncherAgent.csproj" "%AGT_STAGE%\" >nul
copy /y "%ROOT%LaunchModels_Shared.cs" "%AGT_STAGE%\" >nul
copy /y "%ROOT%SecureConfig.cs" "%AGT_STAGE%\" >nul
copy /y "%ROOT%app.ico" "%AGT_STAGE%\" >nul
dotnet publish "%AGT_STAGE%\TeslaLauncherAgent.csproj" ^
dotnet publish "%ROOT%TeslaLauncherAgent.csproj" ^
-c Release ^
-r win-x86 ^
-r %RID% ^
--self-contained true ^
-p:PublishSingleFile=true ^
"-p:DefineConstants=WINFORMS" ^
-o "%BUILD_DIR%\Agent"
if errorlevel 1 (
echo.
echo ERROR: Agent build failed.
rmdir /s /q "%AGT_STAGE%" 2>nul
if "%QUIET%"=="0" pause
exit /b 1
)
rmdir /s /q "%AGT_STAGE%"
echo.
echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
echo.
:skip_agent
:: ── Copy shared assets into build output ─────────────────────────────────────
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
:: -- 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 ───────────────────────────────────────────────────────────────────
:: -- Summary ------------------------------------------------------------------
echo ============================================================
echo Build complete
echo ============================================================
@@ -162,28 +129,8 @@ if %BUILD_SERVICE%==1 echo Service : %BUILD_DIR%\Service\TeslaLauncherServic
if %BUILD_AGENT%==1 echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
echo.
echo Next steps:
echo 1. Copy the TeslaLauncher\ folder to each cockpit PC
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
:: ── Helpers ───────────────────────────────────────────────────────────────────
:check_file
if not exist "%ROOT%%~1" (
echo ERROR: Required source file not found: %~1
exit /b 1
)
exit /b 0
:err_missing
echo.
echo Make sure all source files are in the same folder as build.bat:
echo TeslaLauncherService.cs / .csproj
echo TeslaLauncherAgent.cs / .csproj
echo LaunchModels_Shared.cs
echo SecureConfig.cs
echo install.bat
echo.
if "%QUIET%"=="0" pause
exit /b 1