Reference COM Libraries

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2007
Posts: 37
Reputation: bondo is an unknown quantity at this point 
Solved Threads: 0
bondo's Avatar
bondo bondo is offline Offline
Light Poster

Reference COM Libraries

 
0
  #1
Sep 5th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 85
Reputation: gusano79 is on a distinguished road 
Solved Threads: 5
gusano79 gusano79 is offline Offline
Junior Poster in Training

Re: Reference COM Libraries

 
1
  #2
Sep 7th, 2008
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.
--smg
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 37
Reputation: bondo is an unknown quantity at this point 
Solved Threads: 0
bondo's Avatar
bondo bondo is offline Offline
Light Poster

Re: Reference COM Libraries

 
0
  #3
Sep 8th, 2008
Fantastic! Thanks!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC