Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild pre clean customization

I am working with Visual Studio 2010. I have directed project output to a specific folder which will contain all the DLLs and EXEs when built. However when I clean the solution, the folder is not getting cleaned, and the DLLs are still present in it.

Can anyone tell me how to handle the clean solution command to clear out the folders I want to clean? I tried working with MSBuild and handling the BeforeClean and AfterClean targets, but it did not provide the desired result.

like image 488
winnie Avatar asked Feb 18 '11 04:02

winnie


1 Answers

The answer from Sergio should work but I think it could be cleaner to override the BeforeClean/AfterClean targets. These are hooks into the build/clean process provided by microsoft. When you do a clean, VS do call the targets : BeforeClean;Clean;AfterClean and by default the first and the last do nothing.

In one of your existing .csproj file you can add the following :

<Target Name="BeforeClean">
  <!-- DO YOUR STUFF HERE -->
</Target>
like image 109
Benjamin Baumann Avatar answered Sep 27 '22 23:09

Benjamin Baumann