@echo off setlocal echo ============================================================ echo EnvelopeGenerator.Server - Self-Contained Publish echo Target: win-x64 / .NET 8 / Release echo ============================================================ echo. REM Must be run from the solution root directory. REM This file is located under: EnvelopeGenerator.Server\ set PROJECT=EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj set OUTPUT=publish-output set RID=win-x64 set FRAMEWORK=net8.0 echo [1/3] Cleaning previous publish output... if exist "%OUTPUT%" ( rmdir /s /q "%OUTPUT%" echo Removed: %OUTPUT% ) else ( echo Nothing to clean. ) echo. echo [2/3] Publishing... echo Project : %PROJECT% echo Output : %OUTPUT% echo RID : %RID% echo Framework: %FRAMEWORK% echo. dotnet publish "%PROJECT%" ^ -c Release ^ -f %FRAMEWORK% ^ --self-contained true ^ --runtime %RID% ^ -o "%OUTPUT%" if %ERRORLEVEL% neq 0 ( echo. echo [ERROR] Publish failed! ERRORLEVEL=%ERRORLEVEL% pause exit /b %ERRORLEVEL% ) echo. echo [3/3] Verifying output... set PASS=1 if not exist "%OUTPUT%\EnvelopeGenerator.Server.exe" ( echo [FAIL] EnvelopeGenerator.Server.exe not found! set PASS=0 ) if not exist "%OUTPUT%\hostfxr.dll" ( echo [FAIL] hostfxr.dll not found! (Not a self-contained publish?) set PASS=0 ) if not exist "%OUTPUT%\coreclr.dll" ( echo [FAIL] coreclr.dll not found! (Not a self-contained publish?) set PASS=0 ) if not exist "%OUTPUT%\Microsoft.Extensions.DependencyInjection.Abstractions.dll" ( echo [FAIL] Microsoft.Extensions.DependencyInjection.Abstractions.dll not found! set PASS=0 ) if not exist "%OUTPUT%\web.config" ( echo [FAIL] web.config not found! set PASS=0 ) if "%PASS%"=="1" ( echo. echo ============================================================ echo PUBLISH SUCCEEDED echo Output folder: %~dp0%OUTPUT% echo ============================================================ echo. echo Next steps: echo 1. Copy the contents of '%OUTPUT%' to the IIS application directory echo 2. Set the IIS Application Pool to 'No Managed Code' echo 3. Recycle the Application Pool echo. ) else ( echo. echo ============================================================ echo PUBLISH COMPLETED BUT VERIFICATION FAILED echo Review the FAIL messages above. echo ============================================================ echo. ) pause endlocal