The "RemoveDir" task failed unexpectedly

RaymondKellyRaymondKelly USMember ✭✭✭

Anyone else getting this error when building from VS? I happens repeatedly and I have to manually delete the builds folder to get it to work again.
Error The "RemoveDir" task failed unexpectedly.
System.AggregateException: One or more errors occurred. ---> Xamarin.Messaging.Client.Ssh.SshCommandException: rm: /Users/vbisbest/Library/Caches/Xamarin/mtbs/builds/App.iOS/b63ac9666622ed5ef9ea329c91871775/bin/iPhoneSimulator/Debug: No such file or directory
rm: iOS/App.app/: No such file or directory

Tagged:

Posts

  • NghiaGmNghiaGm USMember
    edited October 2016

    I had set the debug obj directory to ..\..\obj by adding this line to the project (.csproj) file:
    <BaseIntermediateOutputPath>..\..\obj</BaseIntermediateOutputPath>
    I had no problem until the last update of Visual Studio for Xamarin on September 29, 2016

    I set it back the the default:
    <BaseIntermediateOutputPath>obj\iPhone\Debug\</BaseIntermediateOutputPath>
    the problem is now gone.
    I hope this helps.

  • TravisVolkerTravisVolker USUniversity

    I seemingly randomly got this error. I resolved it by restarting my computer. And then cleaning the solution (Right click the solution and select "Clean Solution"). Then I was able to build and rebuild the solution and run it on all the simulators.

  • ChrisColeTechChrisColeTech USMember ✭✭✭

    @EmilyHuizenga said:
    I started seeing this error after I forced VisualStudio to close after a failed deployment to the iOS emulator. Started working again after restarting VS again and cleaning the solution.

    +1
    Happened to me on the device today..this was also the solution

  • sky.1740sky.1740 USMember

    Same here, happens a few times per day ...

    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: The "RemoveDir" task failed unexpectedly.
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: System.ObjectDisposedException: Cannot access a disposed object.
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: Object name: 'BuildClient'.
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: at Xamarin.VisualStudio.Build.BuildClient.CheckDisposed() in C:\d\lanes\4033\73f58d6d\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 256
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: at Xamarin.VisualStudio.Build.BuildClient.DeleteDirectoryAsync(String path) in C:\d\lanes\4033\73f58d6d\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 178
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: at Microsoft.Build.Tasks.RemoveDir.Execute() in C:\d\lanes\4033\73f58d6d\source\xamarinvs\src\MSBuild\Xamarin.MacDev.Tasks\MsBuildTasks\RemoveDir.cs:line 18
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    • C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(367,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
  • DaveYDaveY USUniversity ✭✭
    edited March 2017

    Yes, I am this getting this error now as well. I tried with multiple projects same issue. All sorts of issues now that i installed the windows ios simulator (not even using now). I removed with file explorer the bin and object directories, restarting vs.net 2017, performed another clean and built. Note, I also removed the bin\iPhoneSimulator\Debug directory. Now I have it working again. That could be the solution in this particular case.

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    This happens to me when I cancel a build midway and then try to clean the project / solution, not always of course.

    I suspect that when I abort a build some temp files are still write locked and the clean op is not able to remove that directory. As mentioned in previous posts, exiting the VS and restarting resolved the issue most of the time. Rarely that I too had to restart my laptop.

  • RobHouweling.4203RobHouweling.4203 USMember ✭✭

    I have the same issue when VS hangs and I cancel the task and rebuild it (which happens pretty often since I installed VS2017 :( ).
    When restarting VS2015 again and sometimes cleaning the iOS project it works again. Restarting was never necessary in my case.

  • BozhiQianBozhiQian AUUniversity ✭✭

    I am getting this error all the time.

    Error MSB4018: The "RemoveDir" task failed unexpectedly.
    

    System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at Xamarin.Messaging.Ssh.SshService.d__18.MoveNext() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\SshService.cs:line 118
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Xamarin.Messaging.Ssh.SshService.d__19.MoveNext() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\SshService.cs:line 144
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Xamarin.Messaging.Ssh.SshService.d__12.MoveNext() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\SshService.cs:line 41
    --- End of inner exception stack trace ---
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
    at Microsoft.Build.Tasks.RemoveDir.Execute() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\MSBuild\Xamarin.MacDev.Tasks\MsBuildTasks\RemoveDir.cs:line 20
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
    ---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
    at Xamarin.Messaging.Ssh.SshService.d__18.MoveNext() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\SshService.cs:line 118
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Xamarin.Messaging.Ssh.SshService.d__19.MoveNext() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\SshService.cs:line 144
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Xamarin.Messaging.Ssh.SshService.d__12.MoveNext() in C:\d\lanes\4699\fec6f88f\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\SshService.cs:line 41<---
    (1, 1)

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @BozhiQian Weren't the suggested solution above useful to you?

  • BozhiQianBozhiQian AUUniversity ✭✭

    @SharanMasuti
    I have resolved this issue.
    This was only happened in the iOS project but my Macbook is power off. So I turned on my Macbook to be connected with Xamarin Mac Agent. And then all works.

Sign In or Register to comment.