For some time I get the following error dialogs when I open a set of workitems in Excel using the TFS addin

The problem appeared to be caused by the fact that the Team Build integration process adds in a rule for a field called “Microsoft.VSTS.Build.FoundIn” even when the field is not in use for a work item type. And as you can guess we removed this field from some of our work items J

Now I had some Great help from the Microsoft development team in assessing this issue. Amit Ghosh was so kind to provide me with a script that I could run to see what which work items are causing these problems. You can see the script you need to run below.

select distinct c.String as WITName, w.ProjectID as ProjectID–, w.*, wu.*, r.*
from WorkItemTypes as w
join WorkItemTypeUsages as wu
on w.WorkItemTypeID = wu.WorkItemTypeID
join RulesAreUsed as r
on r.RootTreeID = w.ProjectID
join Constants as c
on w.nameconstantid = c.constid
and w.nameconstantid = r.fld1isconstid
and r.ThenFldID = 10016 — THis is the ID of the Microsoft.VSTS.Build.FoundIn field
and wu.fDeleted = 1 — Field is not in use in the WIT
and r.fDeleted =— But there is a non-deleted rule which references it
select [Name] as ProjectName from TreeNodes
where ID = 69 — ID of project from previous Query.

Now this will give you a list of work item types that can cause the problem. Unfortunately, there is no easy way to fix this issue since TFS will keep adding the rule.(fixing it on the server will cause the problem to reappear when the Build system processes a notification again). The easiest thing to do would be to add this field back into the Work Item Types from which it is missing.

And that is exactly what I did. I just added the definitions back in again using the TFS Power Tools.

If you don't use the tools, you can do it by hand adding the following XML to the Fields section:

<FIELD reportable="dimension" type="String" name="Found In" refname="Microsoft.VSTS.Build.FoundIn">

  <HELPTEXT>The build in which the bug was found</HELPTEXT>


    <LISTITEM value="&lt;None&gt;" />


The fields are now in the work items but we just don't make it visible on the form. That has from an end user perspective the same result as removing the field, which is fine for us.