Is that possible to call .net 2.0 com component fro .net 1.1application?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aimlab08@gmail.com

    Is that possible to call .net 2.0 com component fro .net 1.1application?

    Hi all,

    We have an application which is created in .net 1.1(Visual studio
    2003). Now we need to create maps from this application. The only
    chioce for us is to use ESRI libraries to generate map images.

    The issue is, current version of ESRI (ArvGIS 9.2) only support .net
    2.0. I wrote a map component with Visual studio 2005, and check the
    "Register for COM interop" for the project. This creates both dll and
    tlb assemblies.

    I was not able to add this com component to my .net 2003 application
    as reference. When I tried to add the tlb file as the reference, I got
    the following error message:

    "A reference to "myMapCom" could not be added. Converting the type
    library to a .NET assembly failed. Type library myMapCom was exported
    from a CLR assembly and can not be re-imported as a CLR assembly."

    Any idea for solving this issue?

    Thanks.

    Linda
  • Jeroen Mostert

    #2
    Re: Is that possible to call .net 2.0 com component fro .net 1.1application?

    aimlab08@gmail. com wrote:
    We have an application which is created in .net 1.1(Visual studio
    2003). Now we need to create maps from this application. The only
    chioce for us is to use ESRI libraries to generate map images.
    >
    The issue is, current version of ESRI (ArvGIS 9.2) only support .net
    2.0. I wrote a map component with Visual studio 2005, and check the
    "Register for COM interop" for the project. This creates both dll and
    tlb assemblies.
    >
    I was not able to add this com component to my .net 2003 application
    as reference. When I tried to add the tlb file as the reference, I got
    the following error message:
    >
    "A reference to "myMapCom" could not be added. Converting the type
    library to a .NET assembly failed. Type library myMapCom was exported
    from a CLR assembly and can not be re-imported as a CLR assembly."
    >
    Any idea for solving this issue?
    >
    First, you absolutely want to consider converting your 1.1 application to
    2.0. There's no point clinging to VS 2003 and the 1.1 runtime, especially
    since recent Windows installations don't have the 1.1 runtime at all and
    simply run 1.1 assemblies in the 2.0 runtime as well (so you might as well
    deal with the compatibility issues now). If the argument is that your
    clients only have 1.1 installed: in that case, you cannot use 2.0 components
    at all, so that would not seem to be an issue.

    As you've discovered, direct COM interop between .NET assemblies isn't
    supported (because .NET assemblies should call each other directly -- but
    VS2003 can't handle 2.0 assemblies). You can use COM+ by deriving your 2.0
    component from ServicedCompone nt and deploying it as a server, but this has
    some runtime overhead.

    One workaround could be to create a stub 1.1 assembly with empty
    implementations and sign it with the same strong name as your 2.0 assembly.
    You can then deploy the 2.0 assembly and set up binding redirection in the
    app.config to force the runtime to load the new assembly instead. This works
    only if the entire application is running under the 2.0 framework, and it
    has some obvious maintenance problems. Disclaimer: I haven't tested this.

    --
    J.

    Comment

    Working...