none
Interop n00b question RRS feed

  • Question

  • Hi everyone,

    This is such a basic question that I'm embarrassed to even be asking it.

    I'm building a library of Html helpers for MVC. I'm using several .dll's from NuGet to build this library, which will be used internally. The problem I'm experiencing is that I don't know how to make the .dll's I'm referencing be included in the final library without having to add them to the GAC or use move them along with the the library. I'm fairly sure this has something to do with Embed Interop, but most of the articles I've read have to do with interop between one dll being included in another dll, both being created by the same person. I'm looking to interop with dll's from someone else.

    Thanks in advance,
    Andrew 


    • Edited by B00mtown Friday, January 6, 2012 3:48 PM
    Friday, January 6, 2012 3:48 PM

Answers

  • I have never heard anyone use the term "interop" to refer to the interaction between two .net libraries.  I have only seen the term used to describe the process of interacting from .net with an unmanaged library, usually the Windows API.

    But in general, I don't know of a way of "assimilating" one .net dll into another .net dll.  But why do you even want to do that?  It is as simple as copying both dll's.  Why do you want to integrate the code base of a third party dll into your own dll?


    Jose R. MCP
    • Marked as answer by B00mtown Friday, January 6, 2012 8:51 PM
    • Unmarked as answer by B00mtown Friday, January 6, 2012 8:51 PM
    • Marked as answer by Paul Zhou Monday, January 16, 2012 4:37 AM
    Friday, January 6, 2012 3:56 PM
  • The reason why dll's exist is because having one huge assembly sucks. With dll's you can get away with only loading what you need to, it's easier to make changes to, buddy test, etc. If you write a good assembly loader (http://msdn.microsoft.com/en-us/library/system.reflection.moduleresolveeventhandler.aspx) you shouldn't need to worry about a lot of the problems that you listed.
    • Marked as answer by Paul Zhou Monday, January 16, 2012 4:37 AM
    Friday, January 6, 2012 9:34 PM

All replies

  • I have never heard anyone use the term "interop" to refer to the interaction between two .net libraries.  I have only seen the term used to describe the process of interacting from .net with an unmanaged library, usually the Windows API.

    But in general, I don't know of a way of "assimilating" one .net dll into another .net dll.  But why do you even want to do that?  It is as simple as copying both dll's.  Why do you want to integrate the code base of a third party dll into your own dll?


    Jose R. MCP
    • Marked as answer by B00mtown Friday, January 6, 2012 8:51 PM
    • Unmarked as answer by B00mtown Friday, January 6, 2012 8:51 PM
    • Marked as answer by Paul Zhou Monday, January 16, 2012 4:37 AM
    Friday, January 6, 2012 3:56 PM
  • Yeah. Sorry about throwing around the word Interop. I'm so over my head here, I'm looking for any word that makes even the slightest sense.

    To answer your question, the library I'm building may wind up having a lot of these third party dlls, and some of them may not be open source.

    A lot of what I'm doing is taking common third party WebForm controls and converting them into MVC Html helpers with associated filters. A great example of what I'm doing is with Recaptcha, where I use the output HTML from Recapcha's web form DLL, and render it using an HTML helper. Then, I created a filter to check that the Recaptcha was correct.

    I totally understand if this falls in the "Impossible" category. If I have to throw around a bunch of DLLs to make this work, I have to throw around a bunch of DLLs, but boy, it would be nice to only have to throw one in the ol' GAC.


    • Edited by B00mtown Friday, January 6, 2012 5:38 PM
    Friday, January 6, 2012 5:37 PM
  • I see the motivation that drives you, but as far as I know, no way.  The only way would be to copy the source code into your own DLL.  At least the only way I know.
    Jose R. MCP
    Friday, January 6, 2012 7:06 PM
  • Thanks Jose. Oh well.

    I'll leave this up as "Unanswered" for a couple more days, in case someone else has some insight, and throw you the Answer points if they don't.

    Friday, January 6, 2012 7:45 PM
  • The reason why dll's exist is because having one huge assembly sucks. With dll's you can get away with only loading what you need to, it's easier to make changes to, buddy test, etc. If you write a good assembly loader (http://msdn.microsoft.com/en-us/library/system.reflection.moduleresolveeventhandler.aspx) you shouldn't need to worry about a lot of the problems that you listed.
    • Marked as answer by Paul Zhou Monday, January 16, 2012 4:37 AM
    Friday, January 6, 2012 9:34 PM
  • Hi,

     

    Has your issue been resolved? Would you mind letting us know the result of the suggestions?

     

    Now I will mark an answer, you can mark others that you think to be so useful to your issue.

    If you still have any questions about this issue, please feel free to let me know. 

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Monday, January 16, 2012 4:37 AM