Custom workitem not created on build failure.
We have created a custom workItem called Build Failure and changed the Microsoft.TeamFoundation.Build.targets
WorkItemType to create this type of workitem when a build fails. Our nightly builds run under the TFSSERVICE user. When the builds fail no work item is created and I can't find anywhere in the logs that says it couldn't create one. When I run the build locally and it fails a Build Failure workItem is created just fine. I first assumed that it was a permissions problem but TFSSERVICE and I have the same permissions. So, to recap: nightly builds do not create custom work item when they fail. Local builds create workitems when they fail. Any Ideas?
I'd recommend not modifying Microsoft.TeamFoundation.Build.targets. It's not intended for customization, and it will be replaced when you upgrade to the next version. You can specify the work item type and fields in the tfsbuild.proj file.
When you run the build locally, are you running msbuild on the tfsbuild.proj file or something different?
Buck
it still doesn't create a work item in the nightly build. It's strange that if I log on to the build server and run the same script the nightly build runs it will create a work item, but the nightly builds alone do not. I'm going to try logging on with the TFSSERVICE account and run the script.
Update: After running the build logged on as TFSSERVICE it did not create a work Item. I think this is a permissions problem. TFSSERVICE is an Admin on the build server and the Database. Any ideas?
I solved the problem, but it still doesn't really make sense. After the build the assemblies are copied to another server. The TFSSERVICE account did not have permissions to write to this folder. So, the "AfterDropBuild" failed which I guess stops it from creating a workitem? If the "AfterDropBuild" fails shouldn't that just be part of the information on the workitem? But, it works now so Thanks.
The issue here has to do with the ordering of targets - the CreateWorkItem target comes after the DropBuild target, so if a build failure occurs during DropBuild the CreateWorkItem target is never executed. If you mark any tasks in your AfterDropBuild target override with ContinueOnError=true any errors encountered will be converted to warnings and the CreateWorkItem target should still be reached.
-Aaron