@echo off
setlocal

if "%~0"=="REBUILD_R.cmd" goto START
cls
echo RE-BUILDING "RELEASE" CONFIGURATION:
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

:START
call #SETTINGS.cmd
if %errorlevel% neq 0 goto ERROR

call :EXEC_CMD MsBuild /nologo "%#ProjectFileName%" /t:"_CleanTargetOutput_"
if %errorlevel% neq 0 goto FAILURE

call :EXEC_CMD MsBuild /nologo "%#ProjectFileName%" /t:"Rebuild" /p:Configuration="Release"
if %errorlevel% neq 0 goto FAILURE

::==================================================================================================

:SUCCESS
if "%~0"=="REBUILD_R.cmd" goto FINISH
echo.
echo ÜÜÜ REBUILD (RELEASE) ÄÄ SUCCESS ÜÜÜ
goto FINISH

:FAILURE
if "%~0"=="REBUILD_R.cmd" goto ERROR
echo.
echo ÜÜÜ ## REBUILD (RELEASE) ÄÄ FAILURE ÜÜÜ
goto ERROR

::==================================================================================================

:EXEC_CMD
echo.
echo ^>^> %* ...
echo.
call :RESET_ERROR
%*
goto :EOF

::==================================================================================================
:RESET_ERROR
set errorlevel=0
set errorlevel=
goto :EOF
::==================================================================================================
:ERROR
if not "%~0"=="REBUILD_R.cmd" (
echo 
if not "%$cmd_plain%"=="1" pause )
endlocal
verify # 2>nul
goto :EOF
:FINISH
endlocal
if not "%~0"=="REBUILD_R.cmd" (
echo.
if not "%$cmd_plain%"=="1" pause )
call :RESET_ERROR
goto :EOF
::==================================================================================================
