Build error: "Unable to copy file ... " / "Could not copy ..."

DmytroBondarenkoDmytroBondarenko USMember ✭✭

I saw this problem when I used the Alpha channel, so I switched back to the Release channel.
Today I installed the latest version of the XF for VS ( and Mac and I have been start getting that error again.

What I tried to fix that (non of this is working perfectly):
1. Clean & Rebild the solution
Sometime I get error like that -
Or some problems with connection to the Mac -
2. kill all the Msbuild processes via 'tskill msbuild'
3. delete bin and obj folders manually (I never saw there locked files)
4. run VS as Administrator
5. restart VS and Mac

In general 1&2 could help me, but sometimes only the 5 can affect on the build process.

Really hard to do something with the project now. I have to spend a lot of time just for run the App.


  • LyndonHugheyLyndonHughey USUniversity ✭✭✭
    edited May 2017

    I'm also having this problem. Clean and rebuild works about 50% of the time. This issue is happening about once an hour. I updated to the latest stable build yesterday.

  • DmytroBondarenkoDmytroBondarenko USMember ✭✭

    @LyndonHughey said:
    I'm also having this problem. Clean and rebuild works about 50% of the time. This issue is happening about once an hour. I updated to the latest stable build yesterday.

    try to reboot mac and restart vs. That works for me ~90% of the time.

  • TakYongKimTakYongKim USMember

    I got a similar issue in VS 2017 Enterprise on Windows after updating yesterday.

  • DmytroBondarenkoDmytroBondarenko USMember ✭✭

    I found solution. @TakYongKim @LyndonHughey
    Write an cmd script with del command that delete problem files and run it after error or each time before start project building.

  • jhorvjhorv USMember ✭✭

    I've also been having this in VS 2017 Enterprise, ever since I installed the Stable update on the 10th.
    Using Process Explorer, I've found that it's always devenv.exe holding it open.
    This is really aggravating - when will it stop being such a fight to use this stuff?

  • MarkDownesMarkDownes USUniversity ✭✭

    I am also experiencing this issue on almost every build since downloading the latest Xamarin updates yesterday. I using Visual Studio 2015 on Windows. Fix for now is to run a batch file which deletes all bin/obj folders and then try again.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    Hi All,

    I've filed a bug to track this issue here:

    Please add your details to the bug report and CC yourself. I'd like to know your version information, diagnostic build log (add as attachment) and also if you can provide a project that seems to reproduce this.


  • LyndonHugheyLyndonHughey USUniversity ✭✭✭

    Thanks @DmytroBondarenko I've taken the task kill command and added it as a post build routine. It'll provide a patch for now.

  • KarthikeyanSekarKarthikeyanSekar USMember ✭✭

    @LyndonHughey Please Share your Valuable patch code

  • zahikramerzahikramer ILMember ✭✭✭

    This error has also reports here:

    and here:

    I think it was before 15.2 also...

    Please someone give me obfuscator tool to apply it on my solution with 30 projects (backend and frontend) and i'll send my project to debug.

  • LyndonHugheyLyndonHughey USUniversity ✭✭✭

    @DmytroBondarenko I thought my post build code was executing properly but i was not. It was just not reporting an error. Unfortunately, the post build routine calls are more difficult than expected. I've now reverted back to having a permanent command window open so I can quickly run the "tskill msbuild" command.

  • PhilippeTPhilippeT FRMember ✭✭
    edited May 2017

    I am also experiencing this issue (with vs 2017 current release & vs 2017 preview).
    My "workaround" right now is to work only with one project at a time ( => compile, then unload all other related projects ). No more copy = no more bug ... :/

    PS : A fast fix would really be appreciated : This bug is really a productivity killer ...

Sign In or Register to comment.