943,742 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 1032
  • C# RSS
Sep 5th, 2008
0

Reference COM Libraries

Expand Post »
Does anyone know how to reference a COM library from the command-line? Specifically, I need to reference CDOSYS.dll. Whenever I try to include the reference when I compile I get a message saying:

fatal error CS0009: Metadata file 'c:\WINDOWS\system32\cdosys.dll' could not be
opened -- 'An attempt was made to load a program with an incorrect
format. '

Anyone know how to do this?

NOTE: I have to do this in command-line. Adding the reference with an IDE isn't an option. I know how to do that.
Similar Threads
Reputation Points: 11
Solved Threads: 0
Light Poster
bondo is offline Offline
43 posts
since Apr 2007
Sep 7th, 2008
1

Re: Reference COM Libraries

You can't link directly to a COM library; you have to link to a .NET interop library. The VS IDE secretly generates this library for you when you add a COM project reference. Since you're using the command line, you'll have to generate it yourself. Use tlbimp.exe; it comes with the SDK.
Reputation Points: 182
Solved Threads: 71
Posting Pro in Training
gusano79 is offline Offline
475 posts
since May 2004
Sep 8th, 2008
0

Re: Reference COM Libraries

Fantastic! Thanks!
Reputation Points: 11
Solved Threads: 0
Light Poster
bondo is offline Offline
43 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Reflection question
Next Thread in C# Forum Timeline: 3D graphics vs 2D graphics in games





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC