@echo off SET TAR=Release_Build SET CSharpBuilder="dotnet build --configuration Release" SET CUR=%CD% REM Remove old release folder rmdir /Q /S %TAR% cd Stamp RVStampCore.exe cd .. for /f %%f in ('dir /s /b *.sln') do call:BuildSLN %%f for /f %%f in ('dir /AD /b .') do call:MoveRelease %%f IF EXIST %TAR% (call:CleanProcess) for /f %%f in ('dir /s /b /a:d obj') do call:CleanProject %%f for /f %%f in ('dir /s /b /a:d bin') do call:CleanProject %%f ::-------------------------------------------------------- ::-- Function to Build ::-------------------------------------------------------- :CleanProject - here starts my function identified by it's label echo. echo. Cleaning %~1 IF EXIST %~1 (rmdir /Q /S %~1) goto:eof ::-------------------------------------------------------- ::-- Function to Build Project ::-------------------------------------------------------- :MoveRelease - here starts my function identified by it's label echo. echo. Move Release %~1 IF NOT "%~1" == "eModule" ( IF NOT "%~1" == "packages" ( IF NOT "%~1" == "%TAR%" ( mkdir %TAR% mkdir %TAR%\%~1 XCOPY %~1\bin\Release %TAR%\%~1 /E /Y /I ) ) ) goto:eof ::-------------------------------------------------------- ::-- Function to SLN ::-------------------------------------------------------- :BuildSLN - here starts my function identified by it's label echo. echo. Build SLN %~1 dotnet build --configuration Release goto:eof ::-------------------------------------------------------- ::-- Function to Clean ::-------------------------------------------------------- :CleanProcess - here starts my function identified by it's label echo. echo. CleanProcess CD /D %TAR% del /Q /S *.pdb del /Q /S *.vshost.* del /Q /S *.bak del /Q /S *.map del /Q /S *.scss del /Q /S *.bat del Readme.txt del TODO.txt CD /D %CUR% goto:eof