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