How to: Import UML Model Elements from XMI Files

This Visual Studio 2010 feature pack lets you add UML elements from other tools to UML diagrams in Visual Studio 2010 Ultimate by importing them as XML Metadata Interchange (XMI) 2.1 files. This release supports importing elements for UML sequence diagrams, class diagrams, and use case diagrams. You can use UML Model Explorer to view imported elements and add them to existing UML diagrams or new UML diagrams. For more information, see Visual Studio Feature Packs.

Important

You must install a Visual Studio 2010 Feature Pack to use this feature.

Procedures

Before you import model elements from .xmi files, you must have a Visual Studio solution that contains at least one modeling project. If the solution does not contain a modeling project, you must first add a modeling project before you can import elements. For more information, see How to: Create UML Modeling Projects and Diagrams.

Note

An .xmi file might contain elements that have custom profiles. When you import an .xmi file, you will be prompted to install these profiles. If you do not install the profiles when prompted, then only the elements will be imported. You will have to import the .xmi file again to use the profiles. After you install the profiles, you will be prompted to restart Visual Studio. You must then import the .xmi file again to import the elements. If you do not restart Visual Studio, you will be prevented from importing any .xmi files, or elements, until Visual Studio is restarted.

To import model elements from an .xmi file

  1. Open a Visual Studio solution that contains at least one modeling project.

    Tip

    Elements are imported into the first model in the solution. To import elements into a specific model, unload all the other modeling projects from the solution, and then reload the projects after you finish importing elements.

  2. On the Architecture menu, click Import XMI.

  3. In the Import an XMI File dialog box, browse to the .xmi file, and then select it.

  4. If any custom profiles are available for you to install, a message box appears and prompts you to install those profiles:

    To

    Follow these steps

    Install profiles and then import the elements.

    1. Click Yes to install the profiles.

      A message box appears and prompts you to restart Visual Studio.

    2. Click Yes to restart Visual Studio.

      NoteNote
      If you click No, you will be prevented from importing any more .xmi files until Visual Studio is restarted.
    3. Import the .xmi file again to import the elements.

    Import elements without their profiles.

    Click No.

    You will have to import the .xmi file again to use the profiles.

    The Output window displays the status of the imported elements, indicates whether any warnings occurred, and provides the location of the XML log file to which the warnings were saved. The log file has the same name as the imported .xmi file, for example, XMIFileName.XmiImportLog.xml. If profiles were imported, a second log file is created with the following name: XMIFileName.XmiImportLog.profile.xml.

  5. To view the imported elements, open UML Model Explorer and expand the first model node.

    Tip

    To open UML Model Explorer, on the Architecture menu, point to Windows, and then click UML Model Explorer.

  6. To add imported elements to their corresponding UML diagram, drag them from UML Model Explorer to the diagram surface.

    Tip

    To visualize an entire sequence, drag an Interaction element from UML Model Explorer to a blank sequence diagram.

See Also

Concepts

How to: Create UML Modeling Projects and Diagrams

Microsoft Visual Studio 2010 Visualization and Modeling Feature Pack