Creating TFS Work items Based On SharePoint Build Outcome
While fixing builds for my current project, and I’m now finally about half way through em, one problem that bubbled up was that the previously employed build manager had attempted to put together some code to have a build based on compilation success/failure of his SharePoint projects to generate work items. Now, at first glance his code looked correct to me (I’ve stripped it down a stitch):
- <UsingTask TaskName="Microsoft.TeamFounadtion.Build.Tasks.CreateNewWorkItem" AssemblyFile="$(TeamBuildRefPath)\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll" />
- <Target Name="AfterCompile" Condition=" '$(BuildBreak)'!='true' and '$(IsDesktopBuild)'!='true' " >
- <CreateNewWorkItem TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
- Description="BUILDLOG : $(DropLocation)$(BuildNumber)\BuildLog.txt."
- Title="Build - $(BuildNumber) completed just great!"
Nothing about that at first glance looked wrong, but he was getting the error:
A Work Item could not be created for failures in build ‘build’. Please verify that the work item type ‘Task’ is supported in team project ‘proj’ and it has field ‘Microsoft.VSTS.Build.FoundIn’ defined.
Now this problem implies that there wasn’t some of the required foundation laid down before the aforementioned code was integrated. Basically, a work item type Task defined in your team project, then you need to create that first. So bascially hack up the work item type definition file with those definitions, and you are good to go!