Author Interop Assemblies
This page describes how gmStudio creates and uses runtime-callable Interop assemblies for your .NET migration. This information is only relevant to migrations that are using the "External=Interop" handling strategy.Living with Interop
Despite its simple premise, COM Interop is one of the more difficult areas of .NET development. If your migration team is planning to use Interop, we recommend that you fully understand the implications in terms of debugging, builds, deploying, and security; in fact, you may want to conduct some proof of concept work early on to identify specific limitations or issues. MSDN has extensive information on this, and several outstanding books were published in the early days of .NET:-
Adam Nathan's: .NET and COM the Complete Interoperability Guide
- Andrew Troelsen's: COM and .NET Interoperability
Local and External Components
COM dependencies can be classified as being either local or external:-
A Local component is based on a migration unit that is part of the
migration project.
- Local components are defined by their source code (which is internal to the Migration Project).
- Local components are not Interoped; any projects that reference them use the .NET build products of these components.
-
An External component is based on a reference to a COM type
library file (TLB, DLL, OCX, etc.) that is external to the migration
project.
- External components are binary files (pre-compiled from source code that is external to the Migration Project).
- Interop assemblies for external COM components are generated from COM typelib files and saved to the Interop folder.
- In order to create Interop assemblies for an external component, the component must be properly registered and ready to load.
- Note that some COM components cannot be fully accessed via Interop.
Validating Interop Assemblies
If you are working on a machine where the COM components referenced by your migration are properly registered, then creating and using Interop assemblies should be a completely automatic process. However, if that is not the case, you will have to identify missing Interop assemblies and create them manually. This can be done using the tlbimp.exe/aximp.exe tools or by using the GenInterop project files created by gmStudio. The RefStat field for each migration task can be used to indicate the status of Interop assemblies for the COM components it references:-
RefStat=READY means all the Interop assemblies
required for the migration unit are found in the Interop
folder.
- RefStat=~ASM means at least one Interop assembly required for the migration unit could not be found in the Interop folder.
Key Point: Controlling RefStat behavior |
The meaning of RefStat=READY is controlled by the RefStatFlags
setting in the application config file.
RefStatFlags = "IDF"; require IDF only. |
-
AsmStat=READY means the Interop assembly is
in the Interop folder.
- AsmStat=NOTFOUND means the Interop assembly is not found in the Interop folder.