I'm currently trying to create a post-build script in Visual Studio to clean up the directory I build releases to. The batch file executes fine and all expected behaviour takes place but in Visual Studio I get a message saying "Call post-build.bat" exited with code 1.
My batch script is as follows:
@echo off
GOTO :CleanFiles
:CleanFiles
set direct = %CD%
IF EXIST *.pdb (
DEL *.pdb
)
IF EXIST *.vshost.exe.config (
DEL *.vshost.exe.config
)
IF EXIST *.WPF4.xml (
DEL *.WPF4.xml
)
IF EXIST System.Windows.Interactivity.xml (
DEL System.Windows.Interactivity.xml
)
IF ERRORLEVEL 0 GOTO MakeDirectories
:MakeDirectories
IF EXIST %direct%lib (
rmdir /s %direct%lib
rmdir /s %direct%config
rmdir /s %direct%output
)
mkdir %direct%lib
mkdir %direct%config
mkdir %direct%output
IF ERRORLEVEL 0 GOTO MoveFiles
:MoveFiles
move /y %direct%*.dll %direct%lib
move /y %direct%*.xml %direct%config
move /y %direct%*.xlsx %direct%output
IF ERRORLEVEL 0 GOTO DelBatch
:DelBatch
DEL "%~f0"
EDIT:
It's the DEL command at the bottom of the batch file. Is there any way I can fix this?