UML-to-C# transformation sample setup instructions

This sample takes approximately 2 minutes to import and configure. The sample describes a complete UML design model that you can import and view, and then transform into working C# code.

Before you begin

To run the UML-to-C# transformation, you must have Microsoft Visual Studio 2005 installed and the target solution must be open . Open Visual Studio before opening your Eclipse IDE.

Before you can transform your model to code, you must create a Visual Studio solution and transformation configuration. The solution you create is the target location for the generated C# code

About this task

To create a transformation configuration and run the transformation:

Procedure

  1. Create a Visual Studio .NET solution:
    1. In Visual Studio 2005, click File > New > Project.
    2. Select a Visual C# project type. For example, expand Visual C# > Windows and then select Empty Project.
    3. Type a name for the project.
    4. Click OK.
  2. Create a transformation configuration:
    1. In a Rational® UML Modeling product, click File > New > Transformation Configuration. If Transformation Configuration is not a menu item, click File > New > Other > Transformations > Transformation Configuration.
    2. In the New Transformation Configuration window, in the Name field, specify a name for the configuration.
    3. From the Forward transformation list, select UML to C# transformation.
    4. Specify the destination for the transformation configuration file. The destination is a relative path in your current workspace. You can specify a fully qualified project name or folder name. If you specify a folder in a project, you must prefix the folder name with a slash (/).
    5. Click Next and then click Create New Target Container.
    6. In the .NET solution window, click Browse and specify the location of your .NET solution.
      Note: To create your target project, Microsoft Visual Studio .Net must be open.
    7. Click Finish.

Results

You have completed the transformation configuration that contains the information required to generate the correct output. To run the transformation, expand IBM Rational Transformations, right-click the transformation configuration (.tc) file you created; then click Transform and click the transformation to run.

What to do next

After you run the transformation, you can view the generated C# source by opening the .NET solution that you specified as the target project.

Feedback