Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete files in Visual Studio Pre-build event command line

I am trying to delete files in my $(TargetDir) within visual studio before building a project.

How do you have to format command line to get around this problem I am getting below? alt text

like image 723
dance2die Avatar asked Apr 20 '09 13:04

dance2die


People also ask

How do I delete files in Visual Studio 2019?

In Windows Explorer, locate and select the files associated with the project or item you want to delete. On the File menu, click Delete.


2 Answers

Try

cd $(TargetDir) del *.tif 

As jvenema pointed out, your $(TargetDir) is expanding into a path containing spaces in the folder names which is breaking the delete command.

like image 50
Eoin Campbell Avatar answered Oct 05 '22 23:10

Eoin Campbell


I ended up using rd /s /q "$(TargetDir)" to clean out the directory. As far as I know it is working.

like image 20
tuck Avatar answered Oct 05 '22 22:10

tuck