Import UML Model Elements from XMI Files

To use UML class, sequence, or use case elements from other tools on UML diagrams in Visual Studio Ultimate, you can import these elements as XML Metadata Interchange (XMI) 2.1 files. After importing these elements, you can use UML Model Explorer to see them and add them to existing or new UML diagrams.

Procedures

Before you import elements from .xmi files, your Visual Studio solution must contain at least one modeling project. To add a modeling project, see 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.

      Note

      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

Create UML Modeling Projects and Diagrams

Edit UML Models and Diagrams