Error when TFSVersioning is used with a TFS path where another Gated Check-in Build exists


You have the following setup on TFS:
A Build for Gated check-in for a given TFS project and and path.
You want to creart a new Build with the TfsVersioning for the same path so to trigger it manually when you want the version to increase.
When you trigger the Build with the TfsVersioning you get the following error:
"Your check-in could not be completed because it affects the following gated build definitions. [folder[folder [gated Build Name] To complete your check-in you will need to queue a build of the shelveset Gated_xxx-xxxxxxxx;"
This is caused because the TfsVersioning tries to check-in the changes for the versions, but this check-in will trigger the Gated Checkin and so, the TfsVersioning check is aborted.
Possible Fix:
At the file 'CheckInFiles.cs' you have already an override for the CI builds. You can add simiral an override for the Gated Check-in. The option OverrideGatedCheckIn can be specified.
Bellow is the changes i did and works for my case at Method Execute(..):
workspace.CheckIn(workspace.GetPendingChanges(), "Versioning Build Process", "NO_CI", null, null,
                              new PolicyOverrideInfo(
                                  "Checking in modified AssemblyInfo files as part of Versioning Build Process",
                                  null), CheckinOptions.SuppressEvent);
WorkspaceCheckInParameters parameters = new WorkspaceCheckInParameters(pendingChanges, "NO_CI");
parameters.OverrideGatedCheckIn = true;
parameters.Author = "Versioning Build Process";
parameters.PolicyOverride = new PolicyOverrideInfo("Checking in modified AssemblyInfo files as part of Versioning Build Process", null);
parameters.SuppressEvent = true;
Thanks, and you also you did a great job with this release!!


jabbera wrote Jul 12, 2013 at 7:05 PM

Thanks for this fix. It worked great for me. Hopefully it's incorporated soon!

wrote Aug 28, 2013 at 9:52 PM

wrote Dec 5, 2013 at 1:36 AM

wrote Dec 13, 2013 at 1:42 PM

kmusun1 wrote Nov 24, 2014 at 6:13 PM

This is very helpful.

wrote Dec 10, 2014 at 4:29 PM

wrote Mar 10, 2015 at 8:06 PM