Annoying interop file

Posted on 2005-05-14
Last Modified: 2013-11-13
Hi, I am using VB.NET to write a program that utilises the Messenger API to perform messenger-like functions. I have included the Messenger API Type Library COM object as a reference (which is all that is needed) but whenever I compile the program I end up with a Interop.MessengerAPI.dll file in the output directory. The problem is that whenever the executable isn't in the same folder as the interop file, it fails with an unhandled exception.

I have tried writing this program in VB6 and all worked perfectly, no interop file dependecy.
Could someone please tell me how to get rid of this annoying dependency or let me know of some sort of .NET alternative to the type library.

Any help is greatly appreciated.
Question by:pegga_ds
    LVL 44

    Expert Comment

    The interop file is ABSOLUTELY required, as it allows the COM DLL to 'look like' it is a .NET DLL ( .NET does NOT, repeat NOT, use COM in any way shape or form).  When you include a COM reference in a .NET program, the .NET framework creates a WRAPPER around the COM DLL, that then makes it appear to the .NET program as a .NET DLL (this is what COM Interoperability is all about) and it is 100% ABSOLUTELY MANDATORY that the Interop.MessengerAPI.dll  be present, and be in the same folder as the EXE, and that CANNOT be changed - that is by design of the .NET Framework.


    Author Comment

    So there is absolutely no way i can make this program (without the interop file) with VB .NET?
    LVL 2

    Accepted Solution


    You can give ILMerge a try (download at

    ILMerge allows you to combine multiple assemblies into one. So, yes, you still need the interop assembly for your program to work, but you don't have to distribute two separate files.



    Author Comment

    thanks arnout, ilmerge worked perfectly. i thought that it would be a bit stupid of microsoft to require two ouput files to run a simple program
    hopefully they will release a .NET version of the messenger API.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    Problem to adjust sheet 1 78
    fizzArray  challenge 1 28
    method argument as final 1 54
    wordlen challenge 3 27
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now