Skip MSBuild on run-aspire.cmd when binaries are still newer than sources.
dotnet run always evaluates the Aspire graph. A second launch after Ctrl+C should not wait on that. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+60
-7
@@ -1,8 +1,10 @@
|
||||
@echo off
|
||||
setlocal
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
rem Starts the whole app: game server, Vite client and the Aspire dashboard.
|
||||
rem Arguments are passed through, e.g. run-aspire.cmd --launch-profile http
|
||||
rem Skips MSBuild when AppHost and Server dlls are newer than C# / csproj / props.
|
||||
rem run-aspire.cmd --launch-profile http
|
||||
rem run-aspire.cmd --rebuild
|
||||
|
||||
cd /d "%~dp0"
|
||||
|
||||
@@ -21,19 +23,70 @@ if errorlevel 1 (
|
||||
echo.
|
||||
)
|
||||
|
||||
set "CONFIG=Debug"
|
||||
set "REBUILD=0"
|
||||
set "ARGS="
|
||||
|
||||
:parse
|
||||
if "%~1"=="" goto parsed
|
||||
if /I "%~1"=="--rebuild" (
|
||||
set "REBUILD=1"
|
||||
shift
|
||||
goto parse
|
||||
)
|
||||
if /I "%~1"=="-c" if not "%~2"=="" set "CONFIG=%~2"
|
||||
if /I "%~1"=="--configuration" if not "%~2"=="" set "CONFIG=%~2"
|
||||
set "ARGS=!ARGS! %1"
|
||||
shift
|
||||
goto parse
|
||||
|
||||
:parsed
|
||||
|
||||
if "%REBUILD%"=="1" (
|
||||
echo [run-aspire] --rebuild: building.
|
||||
goto build
|
||||
)
|
||||
|
||||
where powershell >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo [run-aspire] PowerShell not found, building.
|
||||
goto build
|
||||
)
|
||||
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0tools\apphost-uptodate.ps1" -RepoRoot "%CD%" -Configuration "%CONFIG%"
|
||||
if errorlevel 1 (
|
||||
echo [run-aspire] sources changed or binaries missing, building.
|
||||
goto build
|
||||
)
|
||||
|
||||
echo [run-aspire] binaries are up to date, skipping build.
|
||||
goto run
|
||||
|
||||
:build
|
||||
echo.
|
||||
dotnet build "src\HSchool.AppHost\HSchool.AppHost.csproj" -c "%CONFIG%"
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo [run-aspire] build failed.
|
||||
call :maybe_pause
|
||||
exit /b 1
|
||||
)
|
||||
echo.
|
||||
|
||||
:run
|
||||
echo [run-aspire] Starting the Aspire AppHost. Press Ctrl+C to shut everything down.
|
||||
echo.
|
||||
|
||||
dotnet run --project "src\HSchool.AppHost\HSchool.AppHost.csproj" %*
|
||||
set "EXITCODE=%ERRORLEVEL%"
|
||||
dotnet run --project "src\HSchool.AppHost\HSchool.AppHost.csproj" --no-build --no-restore !ARGS!
|
||||
set "EXITCODE=!ERRORLEVEL!"
|
||||
|
||||
if not "%EXITCODE%"=="0" (
|
||||
if not "!EXITCODE!"=="0" (
|
||||
echo.
|
||||
echo [run-aspire] AppHost exited with code %EXITCODE%.
|
||||
echo [run-aspire] AppHost exited with code !EXITCODE!.
|
||||
)
|
||||
|
||||
call :maybe_pause
|
||||
endlocal & exit /b %EXITCODE%
|
||||
exit /b !EXITCODE!
|
||||
|
||||
rem Keeps the window open when the file was double-clicked from Explorer.
|
||||
:maybe_pause
|
||||
|
||||
Reference in New Issue
Block a user