Microsoft KB Archive/921319

= Error message when you try to import a work item type in Visual Studio Team Foundation Server: &quot;Cannot complete the operation” =

Article ID: 921319

Article Last Modified on 9/8/2006

-

APPLIES TO


 * Microsoft Visual Studio 2005 Team Foundation

-





SYMPTOMS
When you try to import a work item type in Microsoft Visual Studio 2005 Team Foundation Server, you receive the following error message:

Cannot complete the operation. An unexpected error occurred.



CAUSE
This problem occurs if the following conditions are true:
 * You modify an existing rule by setting both the for attribute and the not attribute.
 * The existing rule already had one of the two attributes set.



WORKAROUND
To work around this problem, remove the rule that causes the problem from the original work item type, and then import the updated work item type. Modify the work item type by creating the rule with both the for attribute and the not attribute, and then import the updated work item type again. To do this, follow these steps:   Assume that you have the following work item type already imported into your project.           </FIELDS> <WORKFLOW> <STATES> <STATE value=&quot;State 1&quot;/> </STATES> <TRANSITIONS> <TRANSITION from=&quot;&quot; to=&quot;State 1&quot;> <REASONS> <DEFAULTREASON value=&quot;State *-1-1&quot;/> </REASONS> </TRANSITION> </TRANSITIONS> </WORKFLOW> <FORM> <Layout/> </FORM> </WORKITEMTYPE> </wit:WITD> </li> <li> Modify the work item type by removing the original rule, and then save the file as 1.xml. The XML will resemble the following. <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <wit:WITD xmlns:wit=&quot;http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef&quot; version=&quot;1.0&quot;> <WORKITEMTYPE name=&quot;000.001&quot;> <FIELDS> <FIELD refname=&quot;D000.001&quot; name=&quot;001&quot; type=&quot;String&quot;> </FIELD> </FIELDS> <WORKFLOW> <STATES> <STATE value=&quot;State 1&quot;/> </STATES> <TRANSITIONS> <TRANSITION from=&quot;&quot; to=&quot;State 1&quot;> <REASONS> <DEFAULTREASON value=&quot;State *-1-1&quot;/> </REASONS> </TRANSITION> </TRANSITIONS> </WORKFLOW> <FORM> <Layout/> </FORM> </WORKITEMTYPE> </wit:WITD> </li> <li>Click Start, click Run, type cmd, and then click OK.</li> <li>Type the following command, and then press ENTER:

cd C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

</li> <li>Type the following command, and then press ENTER:

witimport /f 1.xml /t  /p

</li> <li> Modify the work item type by adding the rule again. Add both the for attribute and the not attribute. The XML file will resemble the following. <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <wit:WITD xmlns:wit=&quot;http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef&quot; version=&quot;1.0&quot;> <WORKITEMTYPE name=&quot;000.001&quot;> <FIELDS> <FIELD refname=&quot;D000.001&quot; name=&quot;001&quot; type=&quot;String&quot;>  <LISTITEM value=&quot;Item 1&quot;/> <LISTITEM value=&quot;Item 2&quot;/> </ALLOWEDVALUES> </FIELD> </FIELDS> <WORKFLOW> <STATES> <STATE value=&quot;State 1&quot;/> </STATES> <TRANSITIONS> <TRANSITION from=&quot;&quot; to=&quot;State 1&quot;> <REASONS> <DEFAULTREASON value=&quot;State *-1-1&quot;/> </REASONS> </TRANSITION> </TRANSITIONS> </WORKFLOW> <FORM> <Layout/> </FORM> </WORKITEMTYPE> </wit:WITD> </li> <li>At the command prompt, type the following command, and then press ENTER:

witimport /f 1.xml /t  /p

</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

Steps to reproduce this problem
<ol> <li> Create an XML file that is named 1.xml and that contains the following code. <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <wit:WITD xmlns:wit=&quot;http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef&quot; version=&quot;1.0&quot;> <WORKITEMTYPE name=&quot;000.001&quot;> <FIELDS> <FIELD refname=&quot;D000.001&quot; name=&quot;001&quot; type=&quot;String&quot;>  <LISTITEM value=&quot;Item 1&quot;/> <LISTITEM value=&quot;Item 2&quot;/> </ALLOWEDVALUES> </FIELD> </FIELDS> <WORKFLOW> <STATES> <STATE value=&quot;State 1&quot;/> </STATES> <TRANSITIONS> <TRANSITION from=&quot;&quot; to=&quot;State 1&quot;> <REASONS> <DEFAULTREASON value=&quot;State *-1-1&quot;/> </REASONS> </TRANSITION> </TRANSITIONS> </WORKFLOW> <FORM> <Layout/> </FORM> </WORKITEMTYPE> </wit:WITD> </li> <li>Click Start, click Run, type cmd, and then click OK.</li> <li>Type the following command, and then press ENTER:

cd C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

</li> <li>Type the following command, and then press ENTER:

witimport /f 1.xml /t  /p

</li> <li> Open the 1.xml file. Replace the content of the file with the following code. <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <wit:WITD xmlns:wit=&quot;http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef&quot; version=&quot;1.0&quot;> <WORKITEMTYPE name=&quot;000.001&quot;> <FIELDS> <FIELD refname=&quot;D000.001&quot; name=&quot;001&quot; type=&quot;String&quot;>  <LISTITEM value=&quot;Item 1&quot;/> <LISTITEM value=&quot;Item 2&quot;/> </ALLOWEDVALUES> </FIELD> </FIELDS> <WORKFLOW> <STATES> <STATE value=&quot;State 1&quot;/> </STATES> <TRANSITIONS> <TRANSITION from=&quot;&quot; to=&quot;State 1&quot;> <REASONS> <DEFAULTREASON value=&quot;State *-1-1&quot;/> </REASONS> </TRANSITION> </TRANSITIONS> </WORKFLOW> <FORM> <Layout/> </FORM> </WORKITEMTYPE> </wit:WITD> </li> <li>At the command prompt, type the following command, and then press ENTER:

witimport /f 1.xml /t  /p

</li></ol>

Additional query words: witimport TFS workitem

Keywords: kberrmsg kbtshoot kbinfo kbbug kbprb KB921319

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.