Search code examples
xamarinxamarin.formsvisual-studio-mac

Is there any way to clean bin & obj directories within a solution using Visual Studio for Mac?


Quite often it is necessary to delete bin & obj directories due to some weird errors, especially for Xamarin projects. I was wondering if anyone found an efficient way of dealing with it? By efficient I mean automated or semi-automated solution, so there will be no need to leave the IDE and manually delete this directories.


Solution

  • Will share the solutions I found / created myself.

    'DeepClean' a simple open source extension for Visual Studio for macOs which allows you to do the next things:
    - Delete /bin & /obj dirs
    - Delete /packages dir
    - Delete global NuGet cache
    - Open terminal from any solution folder

    You can get it from here.

    Please use with care.

    Alternatively if you don't want to rely on extensions you could use the next script which will delete all nested bin, obj and packages directories:

    find . -iname "bin" -o -iname "obj" -o -iname "packages" | xargs rm -rf
    

    If you delete the /packages directory you will have to restore the packages for solution otherwise it wont build.