Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Creating a COM component in .NET 5

Creating a COM component in .NET 5

Scheduled Pinned Locked Moved .NET (Core and Framework)
comhelpcsharpdotnetdebugging
14 Posts 4 Posters 83 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    Maybe this will help:

    Quote:

    I used regasm.exe /tlb /codebase to register it

    [[Solved] .net Call C# dll from Delphi - Code Redirect](https://coderedirect.com/questions/188647/call-c-sharp-dll-from-delphi) [dll - RegAsm - When is the /codebase option applicable? - Stack Overflow](https://stackoverflow.com/questions/23939699/regasm-when-is-the-codebase-option-applicable)

    It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

    G Offline
    G Offline
    Gaston Verelst
    wrote on last edited by
    #5

    Thanks for the link! Unfortunately it doesn't help. It seems that regasm doesn't recognize .NET 5 assemblies. Regsvr32 does, and it registers the component / interface / library, but no TLB is generated. That makes it virtually useless. From [Exposing .NET Core components to COM | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com) :

    Quote:

    Unlike in .NET Framework, there is no support in .NET Core or .NET 5+ for generating a COM Type Library (TLB) from a .NET assembly. The guidance is to either manually write an IDL file or a C/C++ header for the native declarations of the COM interfaces.

    So now I'm investigating how to create / compile / use the correct IDL file. Should anyone have some good pointers for that, let me know :-) Thanks, Gaston

    Check out my blog at http://msdev.pro/

    L 1 Reply Last reply
    0
    • G Gaston Verelst

      Thanks for the link! Unfortunately it doesn't help. It seems that regasm doesn't recognize .NET 5 assemblies. Regsvr32 does, and it registers the component / interface / library, but no TLB is generated. That makes it virtually useless. From [Exposing .NET Core components to COM | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com) :

      Quote:

      Unlike in .NET Framework, there is no support in .NET Core or .NET 5+ for generating a COM Type Library (TLB) from a .NET assembly. The guidance is to either manually write an IDL file or a C/C++ header for the native declarations of the COM interfaces.

      So now I'm investigating how to create / compile / use the correct IDL file. Should anyone have some good pointers for that, let me know :-) Thanks, Gaston

      Check out my blog at http://msdev.pro/

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #6

      I'm for the path of least resistance. Unless you need "real time", I would've windows message queues; at least to start with; which might be real enough. [Easily Implement Message Queue Communications Protocols In Your Windows Applications](https://blogs.embarcadero.com/easily-implement-message-queue-communications-protocols-in-your-windows-applications/)

      It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

      G 1 Reply Last reply
      0
      • L Lost User

        I'm for the path of least resistance. Unless you need "real time", I would've windows message queues; at least to start with; which might be real enough. [Easily Implement Message Queue Communications Protocols In Your Windows Applications](https://blogs.embarcadero.com/easily-implement-message-queue-communications-protocols-in-your-windows-applications/)

        It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

        G Offline
        G Offline
        Gaston Verelst
        wrote on last edited by
        #7

        Hi Gerry, I was under the assumption that creating a COM component would still be as easy under .NET 5 as under the previous versions. We don't need real time at all. This would be part of a conversion program, that will run on the client PCs (> 3000 clients, with all sorts of PCs and OS's). I wanted to avoid having to serialize objects on the Delphi side, and to deserialize them on the .NET side. I think that we will resort to creating a file (or a couple of files) in a folder, and when that is done running the conversion program on the client PC. That way we only have to install .NET 5 and the conversion program, which is even easier than using a queue. Thank you for thinking with me for solutions! I am going to do 1 more try, posting the same question on SO. Please don't be insulted ;-) If I find a solution I will post it here.

        Check out my blog at http://msdev.pro/

        L 1 Reply Last reply
        0
        • G Gaston Verelst

          Hi Gerry, I was under the assumption that creating a COM component would still be as easy under .NET 5 as under the previous versions. We don't need real time at all. This would be part of a conversion program, that will run on the client PCs (> 3000 clients, with all sorts of PCs and OS's). I wanted to avoid having to serialize objects on the Delphi side, and to deserialize them on the .NET side. I think that we will resort to creating a file (or a couple of files) in a folder, and when that is done running the conversion program on the client PC. That way we only have to install .NET 5 and the conversion program, which is even easier than using a queue. Thank you for thinking with me for solutions! I am going to do 1 more try, posting the same question on SO. Please don't be insulted ;-) If I find a solution I will post it here.

          Check out my blog at http://msdev.pro/

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #8

          Seems it's more of a "command and control" issue than a data transfer one. Lots of possible scenarios.

          It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

          G 2 Replies Last reply
          0
          • L Lost User

            Seems it's more of a "command and control" issue than a data transfer one. Lots of possible scenarios.

            It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

            G Offline
            G Offline
            Gaston Verelst
            wrote on last edited by
            #9

            Indeed, we have thought of alternatives before going to the "COM road". But COM seemed the easiest in our case for a couple of reasons, hence the initial question here.

            Check out my blog at http://msdev.pro/

            1 Reply Last reply
            0
            • L Lost User

              Seems it's more of a "command and control" issue than a data transfer one. Lots of possible scenarios.

              It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

              G Offline
              G Offline
              Gaston Verelst
              wrote on last edited by
              #10

              According to the replies on SO this is a dead end indeed. We now are going to create classes in C# and in Delphi with all the same properties. We'll then serialize the Delphi classes to JSON, and deserialize them in C#. For this I'm writing a code generator that will use a DSL to describe the classes. It's a work-around, but at least we'll get the work done.

              Check out my blog at http://msdev.pro/

              L 1 Reply Last reply
              0
              • G Gaston Verelst

                According to the replies on SO this is a dead end indeed. We now are going to create classes in C# and in Delphi with all the same properties. We'll then serialize the Delphi classes to JSON, and deserialize them in C#. For this I'm writing a code generator that will use a DSL to describe the classes. It's a work-around, but at least we'll get the work done.

                Check out my blog at http://msdev.pro/

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #11

                That's the protocol; you still need a transport mechanism.

                It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                G 1 Reply Last reply
                0
                • L Lost User

                  That's the protocol; you still need a transport mechanism.

                  It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                  G Offline
                  G Offline
                  Gaston Verelst
                  wrote on last edited by
                  #12

                  This is for a conversion, so the Delphi side will serialize the objects in a folder, and the .NET part will deserialize it and handle it further. It is a One Shot operation, so no need for fancy stuff there.

                  Check out my blog at http://msdev.pro/

                  1 Reply Last reply
                  0
                  • L Lost User

                    The file you're trying to register seems to have no relation to "Convertor"; at least as far as naming goes. And I would have picked a more unique name than "Convertor".

                    It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                    F Offline
                    F Offline
                    financebloghindi
                    wrote on last edited by
                    #13

                    इस घटना में कि आपके पास वीज़ा है, आपको इसे खरीदारी के लिए उपयोग करना चाहिए। जिसके बाद आपको भी उतनी ही राशि का भुगतान करना होगा। यह मानते हुए कि आपको इस वीज़ा किस्त के एवज में एक पुरस्कार के रूप में कैशबैक भी मिलता है, तब, आप स्कोर को और अधिक लाभ देंगे। इस लेख में

                    finance blog

                    आपको एक ऐसी एप्लीकेशन के बारे में बताया जा रहा है, जिसके जरिए अगर आप वीजा बिल का ध्यान रखते हैं तो आपको इसके परिणामस्वरूप कुछ कैशबैक भी मिलता है।

                    1 Reply Last reply
                    0
                    • L Lost User

                      Maybe this will help:

                      Quote:

                      I used regasm.exe /tlb /codebase to register it

                      [[Solved] .net Call C# dll from Delphi - Code Redirect](https://coderedirect.com/questions/188647/call-c-sharp-dll-from-delphi) [dll - RegAsm - When is the /codebase option applicable? - Stack Overflow](https://stackoverflow.com/questions/23939699/regasm-when-is-the-codebase-option-applicable)

                      It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                      N Offline
                      N Offline
                      Noman Nawaz
                      wrote on last edited by
                      #14

                      Yes thanks alot I got the help from . Full Stack User

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups