DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 921319 - Last Review: September 8, 2006 - Revision: 1.3

On This Page

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:
  1. Assume that you have the following work item type already imported into your project.
    <?xml version="1.0" encoding="utf-8"?>
    <wit:WITD xmlns:wit="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef" version="1.0">
        <WORKITEMTYPE name="000.001">
            <FIELDS>
                <FIELD refname="D000.001" name="001" type="String">
                    <ALLOWEDVALUES for="[global]\Team Foundation Administrators">
                        <LISTITEM value="Item 1"/>
                        <LISTITEM value="Item 2"/>
                    </ALLOWEDVALUES>
                </FIELD>
            </FIELDS>
            <WORKFLOW>
                <STATES>
                    <STATE value="State 1"/>
                </STATES>
                <TRANSITIONS>
                    <TRANSITION from="" to="State 1">
                        <REASONS>
                            <DEFAULTREASON value="State *-1-1"/>
                        </REASONS>
                    </TRANSITION>
                </TRANSITIONS>
            </WORKFLOW>
            <FORM>
                <Layout/>
            </FORM>
        </WORKITEMTYPE>
    </wit:WITD>
    
  2. 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="1.0" encoding="utf-8"?>
    <wit:WITD xmlns:wit="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef" version="1.0">
        <WORKITEMTYPE name="000.001">
            <FIELDS>
                <FIELD refname="D000.001" name="001" type="String">
                </FIELD>
            </FIELDS>
            <WORKFLOW>
                <STATES>
                    <STATE value="State 1"/>
                </STATES>
                <TRANSITIONS>
                    <TRANSITION from="" to="State 1">
                        <REASONS>
                            <DEFAULTREASON value="State *-1-1"/>
                        </REASONS>
                    </TRANSITION>
                </TRANSITIONS>
            </WORKFLOW>
            <FORM>
                <Layout/>
            </FORM>
        </WORKITEMTYPE>
    </wit:WITD>
  3. Click Start, click Run, type cmd, and then click OK.
  4. Type the following command, and then press ENTER:
    cd C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
  5. Type the following command, and then press ENTER:
    witimport /f 1.xml /t Team_Foundation_Server_Name /p Project_Name
  6. 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="1.0" encoding="utf-8"?>
    <wit:WITD xmlns:wit="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef" version="1.0">
        <WORKITEMTYPE name="000.001">
            <FIELDS>
                <FIELD refname="D000.001" name="001" type="String">
                    <ALLOWEDVALUES for="[global]\Team Foundation Administrators" not="[global]\Team Foundation Valid Users" >
                        <LISTITEM value="Item 1"/>
                        <LISTITEM value="Item 2"/>
                    </ALLOWEDVALUES>
                </FIELD>
            </FIELDS>
            <WORKFLOW>
                <STATES>
                    <STATE value="State 1"/>
                </STATES>
                <TRANSITIONS>
                    <TRANSITION from="" to="State 1">
                        <REASONS>
                            <DEFAULTREASON value="State *-1-1"/>
                        </REASONS>
                    </TRANSITION>
                </TRANSITIONS>
            </WORKFLOW>
            <FORM>
                <Layout/>
            </FORM>
        </WORKITEMTYPE>
    </wit:WITD>
    
  7. At the command prompt, type the following command, and then press ENTER:
    witimport /f 1.xml /t Team_Foundation_Server_Name /p Project_Name

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce this problem

  1. Create an XML file that is named 1.xml and that contains the following code.
    <?xml version="1.0" encoding="utf-8"?>
    <wit:WITD xmlns:wit="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef" version="1.0">
        <WORKITEMTYPE name="000.001">
            <FIELDS>
                <FIELD refname="D000.001" name="001" type="String">
                    <ALLOWEDVALUES for="[global]\Team Foundation Administrators">
                        <LISTITEM value="Item 1"/>
                        <LISTITEM value="Item 2"/>
                    </ALLOWEDVALUES>
                </FIELD>
            </FIELDS>
            <WORKFLOW>
                <STATES>
                    <STATE value="State 1"/>
                </STATES>
                <TRANSITIONS>
                    <TRANSITION from="" to="State 1">
                        <REASONS>
                            <DEFAULTREASON value="State *-1-1"/>
                        </REASONS>
                    </TRANSITION>
                </TRANSITIONS>
            </WORKFLOW>
            <FORM>
                <Layout/>
            </FORM>
        </WORKITEMTYPE>
    </wit:WITD>
    
  2. Click Start, click Run, type cmd, and then click OK.
  3. Type the following command, and then press ENTER:
    cd C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
  4. Type the following command, and then press ENTER:
    witimport /f 1.xml /t Team_Foundation_Server_Name /p Project_Name
  5. Open the 1.xml file. Replace the content of the file with the following code.
    <?xml version="1.0" encoding="utf-8"?>
    <wit:WITD xmlns:wit="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef" version="1.0">
        <WORKITEMTYPE name="000.001">
            <FIELDS>
                <FIELD refname="D000.001" name="001" type="String">
                    <ALLOWEDVALUES for="[global]\Team Foundation Administrators" not="[global]\Team Foundation Valid Users" >
                        <LISTITEM value="Item 1"/>
                        <LISTITEM value="Item 2"/>
                    </ALLOWEDVALUES>
                </FIELD>
            </FIELDS>
            <WORKFLOW>
                <STATES>
                    <STATE value="State 1"/>
                </STATES>
                <TRANSITIONS>
                    <TRANSITION from="" to="State 1">
                        <REASONS>
                            <DEFAULTREASON value="State *-1-1"/>
                        </REASONS>
                    </TRANSITION>
                </TRANSITIONS>
            </WORKFLOW>
            <FORM>
                <Layout/>
            </FORM>
        </WORKITEMTYPE>
    </wit:WITD>
    
  6. At the command prompt, type the following command, and then press ENTER:
    witimport /f 1.xml /t Team_Foundation_Server_Name /p Project_Name

APPLIES TO
  • Microsoft Visual Studio 2005 Team System Team Foundation:
Keywords: 
kberrmsg kbtshoot kbinfo kbbug kbprb KB921319
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support