Annoying interop file

Posted on 2005-05-14
Medium Priority
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
  • 2
LVL 44

Expert Comment

ID: 14004562
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

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

Accepted Solution

amg42 earned 1000 total points
ID: 14008959

You can give ILMerge a try (download at http://www.microsoft.com/downloads/details.aspx?FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0&displaylang=en).

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

ID: 14015668
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.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

840 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