Sunday, July 22, 2012

Add Clean script to MsBuild

Add the following Target to the Project.csproj file :

    <Target Name = "Clean">
<RemoveDir Directories="$(builtdir)" />
</Target>


We will have to declare what is builtdir (which will be pointing to something like bin) and for this we will have to add 


<builtdir>BuiltApp</builtdir>


and to create a new directory during build process


<MakeDir Directories = "$(builtdir)" Condition = "!Exists('$(builtdir)')" />



Now to clean use the following



msbuild <file name>.proj /target:Clean



and to build use



msbuild <file name>.proj /target:Build

No comments:

Post a Comment

Thank you for your feedback