[Mono-list] XBuild question removing directories

Mike Christensen mike at kitchenpc.com
Thu Dec 22 01:20:42 EST 2011


I have the following target:

  <Target Name="Clean">
    <RemoveDir Directories="$(BuildDir)" Condition=" Exists('$(BuildDir)') " />
    <RemoveDir Directories="Imp/bin" Condition=" Exists('Imp/bin') " />
    <RemoveDir Directories="Imp/obj" Condition=" Exists('Imp/obj') " />
    <RemoveDir Directories="Modeler/bin" Condition=" Exists('Modeler/bin') " />
    <RemoveDir Directories="Modeler/obj" Condition=" Exists('Modeler/obj') " />
    <RemoveDir Directories="Queue/bin" Condition=" Exists('Queue/bin') " />
    <RemoveDir Directories="Queue/obj" Condition=" Exists('Queue/obj') " />
    <RemoveDir Directories="WebSite/bin" Condition=" Exists('WebSite/bin') " />
    <RemoveDir Directories="WebSite/obj" Condition=" Exists('WebSite/obj') " />
  </Target>

When I run it I get:


~/KitchenPC> ./clean
XBuild Engine Version 2.10.6.0
Mono, Version 2.10.6.0
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/Build is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/Imp/bin is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/Imp/obj is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/Modeler/obj is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/Queue/bin is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/Queue/obj is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
/Users/mike/kitchenpc/build.xml: error : Directory
/Users/mike/KitchenPC/WebSite/obj is not empty  at
System.IO.Directory.Delete (System.String path) [0x00000] in <filename
unknown>:0
  at Microsoft.Build.Tasks.RemoveDir.Execute () [0x00000] in <filename
unknown>:0
~/KitchenPC>

On MSBuild, this works fine.  Is there a way to make it remove these
directories without an error?  I suppose I could Exec a "rm -R -f" but
I'd rather something that was cross-platform.  Thanks!

Mike


More information about the Mono-list mailing list