Error CopyIfChanged

I'm following this issue, someone has seen something similar?

Error 1 The "CopyIfChanged" task failed unexpectedly.
System.UnauthorizedAccessException: Access to the path 'Resources\Resource.Designer.cs' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.Android.Tasks.CopyIfChanged.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext(


  • CheesebaronCheesebaron DKInsider, University mod

    If you have checked your project into TFS or similar it is preventing the build step from editing the Resource.Designer.cs file until you check out the file.

  • This is plaguing me as well. Even when I have the Resource.Designer.cs already checked out in TFS. I hate TFS.

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    It's been a long time since I fixed it, but I saw this during an automated build process using TFS. When TFS does a get latest on the build server, Resource.Designer.cs is read-only. I think I modified my build template to run a quick *.bat script to mark it read/write before compile. Or I might have done that as a pre-compile event. I don't remember, but it was a quick enough fix.

  • JimWilcoxJimWilcox USMember ✭✭
    edited November 2015

    I know this is old but this problem just popped up for me. I have found that you can create a file in the "Resources" folder called ".tfignore". You will need to change the name of this file on the command line as file explorer demands something in front of the first period. The ".tfignore" file should contain the following:


    See this link for details:


  • TayfunztrkTayfunztrk USMember

    @Cheesebaron said:
    Usually I just make a line break in the Resource.Designer.cs file in Visual Studio such that it gets checked out, that simply works, at least for me.

    SOLVED @Cheesebaron is right . Try to write something in the Resource.Designer.cs file then make it writable.

  • Using TFS, I just select all itens on my project folder in Source control explorer > Checkout for Edit. and works for me... ;)

  • JosephMartinezJosephMartinez USMember ✭✭

    I am having this same issue using Visual Studio Team Services. I tried editing the Resource.Designer.cs in Visual Studio, then I checked in my code, and the automated build gave the same error.

    Has anyone successfully solved this issue who is using VSTS for their builds?

  • PrisonerZ3ROPrisonerZ3RO Member ✭✭

    If get this exception while...

    Check out the file in Visual Studio: Project/Resources/Resource.designer.cs

    Sometimes TFS holds onto file locks. You can (easily) ensure all files in a set are unlocked by running the ATTRIB DOS Command in your process.

Sign In or Register to comment.