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. C#
  4. How to "link" a referenced dll to a third party dll I develop.

How to "link" a referenced dll to a third party dll I develop.

Scheduled Pinned Locked Moved C#
questionvisual-studiosalesjsontutorial
4 Posts 2 Posters 14 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.
  • A Offline
    A Offline
    AtaChris
    wrote on last edited by
    #1

    Hello, I divided my solution for a third party dll in VS 2022 into a) 1st.dll in project 1 b) 2nd.dll in project 2 Project 1 references project 2 and creates instances of objects based on classes in project 2. Both dlls are copied to the same folder but only 1st.dll is loaed by an Application to which I have no access except vie an API used by my 1st.dll. My understanding was, that 2nd.dll is kind of linked to 1st.dll, so that it is no necessary in the same folder. I also only want to ONLY ship 1st.dll. But when I delete 2nd.dll from the path my approach does not work. Question: What do I have to to, so that it is sufficient to only have 1st.dll at the customer side available ?

    D 1 Reply Last reply
    0
    • A AtaChris

      Hello, I divided my solution for a third party dll in VS 2022 into a) 1st.dll in project 1 b) 2nd.dll in project 2 Project 1 references project 2 and creates instances of objects based on classes in project 2. Both dlls are copied to the same folder but only 1st.dll is loaed by an Application to which I have no access except vie an API used by my 1st.dll. My understanding was, that 2nd.dll is kind of linked to 1st.dll, so that it is no necessary in the same folder. I also only want to ONLY ship 1st.dll. But when I delete 2nd.dll from the path my approach does not work. Question: What do I have to to, so that it is sufficient to only have 1st.dll at the customer side available ?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      No, the .DLL's are not "linked" in the way you're seem to be thinking. 2.dll is NOT "linked into" 1.dll. They will remain separate .DLL's when you compile them. You said it yourself, 1 REFERENCES 2, so the two .DLL's must be shipped together. You have a choice. You can either rewrite and get rid of the second project, copying your code in the 2 project into the 1 project, then update the references and namespace using statements, rebuild and you'll get your 1.dll file you can ship. OR You can try to use ILMERGE[^] to combine both .DLL's into the same file. You may or may not get away with doing this.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        No, the .DLL's are not "linked" in the way you're seem to be thinking. 2.dll is NOT "linked into" 1.dll. They will remain separate .DLL's when you compile them. You said it yourself, 1 REFERENCES 2, so the two .DLL's must be shipped together. You have a choice. You can either rewrite and get rid of the second project, copying your code in the 2 project into the 1 project, then update the references and namespace using statements, rebuild and you'll get your 1.dll file you can ship. OR You can try to use ILMERGE[^] to combine both .DLL's into the same file. You may or may not get away with doing this.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

        A Offline
        A Offline
        AtaChris
        wrote on last edited by
        #3

        Hello & thank you for your reply. Is there a reason why in C#/.Net we do not have statically linkable libraries (.lib-Files) like in C/C++ ?

        D 1 Reply Last reply
        0
        • A AtaChris

          Hello & thank you for your reply. Is there a reason why in C#/.Net we do not have statically linkable libraries (.lib-Files) like in C/C++ ?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No, static linking is not directly supported. If you want to know why, ask Microsoft. The closest approximation to it is to use ILMerge or similar. Not every library is compatible though, like WPF assemblies or code that uses Reflection.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

          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