4

I'm trying to enable incremental build of my VS solution. In the GUI for xaml build process template, I set "Clean Workspace" to "None" and added /p:IncrementalBuild=True as an MSBuild argument. I then checked in changes to a file, but when I run my TFS build, I immediately get the following error:

Unable to perform the get operation because the file already exists locally

Exception Message: One or more errors occurred while performing a Get operation. (type GetException)
Exception Stack Trace:    at Microsoft.TeamFoundation.Build.Workflow.Activities.SyncWorkspaceInternal.ThrowIfErrorsOccurred.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

I believe TFS gets my file but cannot overwrite the existing file on the build agent and errors out. How can I force it to overwrite the file?

Mark13426
  • 2,569
  • 6
  • 41
  • 75

2 Answers2

6

The file is writable. When there's a writable file, get will not overwrite it unless the /overwrite option is used. However, you would need to figure out how the file is becoming writable. You may want to go back to the default option of creating a new workspace, running a build with verbose logs, and see what is making the file writable.

Buck Hodges
  • 3,342
  • 1
  • 19
  • 20
  • Shouldn't he just simply use the `/overwrite` parameter? `/force`also implies the `/all` parameter, which overwrites all files, not just the writable ones? – Johny Skovdal Aug 11 '16 at 09:48
  • Also, do you by any chance know if that is possible in build vNext? – Johny Skovdal Aug 11 '16 at 09:48
  • You are correct. I've updated my answer to say overwrite. Do you mean if it is possible to specify /overwrite? – Buck Hodges Aug 13 '16 at 02:44
  • Yes, the step with getting the source code, does not appear to be very configurable. – Johny Skovdal Aug 13 '16 at 06:57
  • 1
    I asked, and the answer depends on the version of the build agent in build vnext. The original build vnext agent (1.x) does not provide a way to control whether /overwrite is included. The new agent (2.x) does specify /overwrite every time in order to prevent writable files causing problems. The new agent will be the default in TFS "15" and in VS Team Services. – Buck Hodges Aug 15 '16 at 13:59
0

In XAML Build, you can add a GetOptions input for the SyncWorkspace activity. <mtbwa:SyncWorkspace _locID="Activity037" _locAttrData="DisplayName" DisplayName="Get Workspace" VersionOverride="[GetVersion]" Workspace="[Workspace]" GetOptions="[Microsoft.TeamFoundation.VersionControl.Client.GetOptions.Overwrite]">

See DefaultTemplate.11.1.xaml as a go-by.

TfvcTemplate.12.xaml doesn't expose a way to do it.