Single-instance --------------- Two PSLauncher.exe instances ran in parallel during the user's last release build, locking the repo-root copy and breaking the publish. Two-layer protection: 1. App.xaml.cs uses a Global\ named Mutex (UUID-based key) created at OnStartup. If the mutex is already held, the second instance PostMessages a registered Windows message (PSLAUNCHER_BRING_TO_FRONT) to HWND_BROADCAST and Shutdown()s immediately. 2. MainWindow hooks WndProc via SourceInitialized + HwndSource.AddHook; when it sees the broadcast, it restores from minimized, calls ShowWindow(SW_RESTORE) + Activate() + SetForegroundWindow so the already-running instance pops to the user's foreground. Net result: clicking the launcher icon a second time pops the existing window instead of starting a duplicate process. Tolerant build pipeline ----------------------- - Both csproj post-publish copy targets now have ContinueOnError="WarnAndContinue". A locked PSLauncher.exe at the repo root no longer fails the entire publish — the binary still exists in bin\Release\...\publish\ and the user gets a warning instead of an error. - All four .bat scripts (build-launcher / build-updater / build-all / build-installer) now run `taskkill /F /IM PSLauncher.exe /T` and the same for PSLauncher.Updater.exe before the publish step. This defensively closes any stray instance left behind by previous tests so the build pipeline is clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
37 lines
1.0 KiB
Batchfile
37 lines
1.0 KiB
Batchfile
@echo off
|
|
REM Build complet : launcher + updater (sans creer l'installeur).
|
|
REM Pour l'installeur Inno Setup, utiliser build-installer.bat.
|
|
|
|
setlocal
|
|
set "REPO=%~dp0"
|
|
echo.
|
|
echo ==^> Termine les eventuelles instances qui verrouilleraient les .exe
|
|
taskkill /F /IM PSLauncher.exe /T >nul 2>&1
|
|
taskkill /F /IM PSLauncher.Updater.exe /T >nul 2>&1
|
|
echo.
|
|
echo ==^> dotnet publish PSLauncher.App (Release single-file)
|
|
echo.
|
|
dotnet publish "%REPO%src\PSLauncher.App\PSLauncher.App.csproj" -c Release --nologo
|
|
if %ERRORLEVEL% NEQ 0 goto :fail
|
|
|
|
echo.
|
|
echo ==^> dotnet publish PSLauncher.Updater (Release single-file)
|
|
echo.
|
|
dotnet publish "%REPO%src\PSLauncher.Updater\PSLauncher.Updater.csproj" -c Release --nologo
|
|
if %ERRORLEVEL% NEQ 0 goto :fail
|
|
|
|
echo.
|
|
echo [OK] Les deux exes sont disponibles a la racine du repo :
|
|
echo %REPO%PSLauncher.exe
|
|
echo %REPO%PSLauncher.Updater.exe
|
|
echo.
|
|
pause
|
|
endlocal & exit /b 0
|
|
|
|
:fail
|
|
echo.
|
|
echo [ECHEC] Build echoue avec le code %ERRORLEVEL%.
|
|
echo.
|
|
pause
|
|
endlocal & exit /b %ERRORLEVEL%
|