Review this list of best practices and limitations for
using the C# transformation and visualization features in IBM® Rational® Modeling Extension for Microsoft .NET.
Integration with Microsoft Visual
Studio
- Verify that the correct operating system, service packs, and Microsoft Visual Studio® 2005
or 2008, Standard or Professional Edition, are installed on the computer
before you install or run Rational Modeling Extension
for Microsoft .NET.
- Rational Modeling Extension
for Microsoft .NET only
recognizes and communicates with the first instance of Microsoft Visual Studio 2005 or 2008 that
is open. Run only one instance of Visual Studio on the computer where Rational Modeling Extension
for Microsoft .NET is
being used.
- In Microsoft Visual
Studio, always enable the option to automatically load external changes.
You can set this option on the Documents page by clicking . Ensure that both the Detect
when file is changed outside the environment and Auto-load
changes, if saved check boxes are selected.
- Rational Modeling Extension
for Microsoft .NET uses
a COM mechanism to synchronize with Microsoft Visual Studio. The COM calls
might fail or be rejected when Visual Studio is busy. Do not work
on Microsoft Visual Studio
or make it active when performing the following operations in Rational Modeling Extension
for Microsoft .NET:
- Importing .NET Framework solutions
- Refreshing a project
- Expanding imported projects or files in the Project Explorer view
(for example, expanding the tree view)
- Starting Rational Modeling Extension
for Microsoft .NET in
a workspace where a Visual Studio solution was previously imported
- Composing a .NET Framework visualization diagram
- Running a UML-to-C# or C#-to-UML transformation
Solution import and project management
- When a solution is imported into Rational Modeling Extension
for Microsoft .NET,
it creates Eclipse projects in the Eclipse workspace for every corresponding
C# project in the solution. The project created in Eclipse has the
same name as the C# project in the Microsoft Visual
Studio solution. The following points are important to note about
the projects:
- The created projects in Eclipse have links to the C# files and
.NET Assemblies used by the corresponding C# projects in the Visual
Studio solution. These links are the only way for Rational Modeling Extension
for Microsoft .NET to
retrieve, update and show information about the Visual Studio projects
and its contents in Eclipse. In effect, they act as a view for the
C# projects in Eclipse.
- With the exception of using the UML-to-C# transformations, avoid
using Eclipse mechanisms to modify the imported projects. Using Eclipse
mechanisms to rename these projects or to modify their contents can
lead to unpredictable results. In particular, avoid creating or adding
UML models (.emx) or diagram files (.dnx) in the projects. Instead,
create separate projects (such as UML Project) in Eclipse for these
purposes. Some care is required to avoid creating diagram files (.dnx)
in the imported projects because, when new diagrams are created, the
visualization framework makes their default locations the projects
in which the visualized elements reside.
- You can safely close and re-open the imported projects. You can
also safely delete imported projects. If you need to delete a Visual
Studio project and all of its contents, perform this action in Microsoft Visual Studio.
- If you are not planning to explore the contents of types that
are defined in the .NET framework assemblies (for example, to find
which operations or fields are contained in the type),
select the While parsing .NET assemblies get only types check
box when importing the Visual Studio solution to the Eclipse workspace.
This option is available on the first page of the .NET Solution Import
wizard. This option accelerates the import of the solution and also
accelerates the visualization of C# and .NET types.
- After you import a Visual Studio solution into your Eclipse workspace,
avoid renaming the C# projects in Microsoft Visual
Studio. If you must rename a project, follow the procedure in the
online help. For details, see Renaming C# projects in Visual Studio.
- Never close or open a different solution (other than the one imported
to your Eclipse workspace) in Microsoft Visual
Studio when Rational Modeling Extension
for Microsoft .NET is
running.
- If you use an encoding format for the Microsoft Visual Studio
solution that is different from the default Eclipse encoding, you
must change the encoding preference to the appropriate format so that
the transformation captures the text correctly from the source file:
Click .
C# transformation and visualization
- Before you perform actions in Rational Modeling Extension
for Microsoft .NET,
make sure that the C# projects do not contain syntax errors and that
they compile successfully in Microsoft Visual
Studio. Rational Modeling Extension
for Microsoft .NET uses
Visual Studio Code Model APIs to parse the C# files. These APIs return
incorrect results and NULL values if errors exist in the C# files.
For example, if you change a C# file in Microsoft Visual Studio, and refresh its
project in Eclipse and you cannot expand the file in the Project Explorer
view, the change might have introduced C# syntax errors.
To avoid
this issue, switch to Microsoft Visual
Studio, fix all the syntax errors, rebuild the solution and refresh
the imported project in Eclipse to receive the changes. The Visual
Studio solutions must be in a clean, built state when you apply transformations.
- You can change the encoding of C# projects through Eclipse by
using the Properties command on the pop-up
menu of the imported projects. This encoding takes more time than
usual because Visual Studio projects are typically large.
- If you use the C#-to-UML transformation to generate a UML model
from an existing C# project in Microsoft Visual
Studio, and you want to regenerate all new code from the model, ensure
that you create a new empty project in Visual Studio as the transformation
target or choose a project that does not already have a main() method.
Applications that contain two main() methods generate
Visual Studio compile errors.