Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > EXCHANGE SERVER (TECHNET) > compilation error: The type is defined in an assembly that is not referenced
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 5th August 16:52
omatase@gmailcom
External User
 
Posts: 1
Default compilation error: The type is defined in an assembly that is not referenced



Here is my code:

CDO.Message iMessage = new CDO.MessageClass();

string sFrom; string sDate;

iMessage.DataSource.Open(bstrURLItem,null,
ADODB.ConnectModeEnum.adModeRead,
ADODB.RecordCreateOptionsEnum.adFailIfNotExists,
ADODB.RecordOpenOptionsEnum.adOpenSource,"","");

Here is the compilation error:

The type 'ADODB.ConnectModeEnum' is defined in an assembly that is not
referenced. You must add a reference to assembly 'ADODB,
Version=7.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. C:\Do***ents and Settings\davidbr\My
Do***ents\Visual Studio
2005\Projects\InformXY\InformXY\ExchangeEventSink. cs 45 25 InformXY

the error comes from argument number 3 on line:

iMessage.DataSource.Open(bstrURLItem,null,
ADODB.ConnectModeEnum.adModeRead,
ADODB.RecordCreateOptionsEnum.adFailIfNotExists,
ADODB.RecordOpenOptionsEnum.adOpenSource,"","");

I get a similar error on the 4th and 5th arguments.

Here are some things I have tried that didn't work:

couldn't cast to ADODB.ConnectModeEnum
couldn't use corresponding integer values

I am using C# 2.0. I copied the code directly from a project that works
fine in 1.1. I created interop dlls using tlbimp on some exchange dlls.
The iMessage object was instantiated from a namespace derived from one
dll and the enums wer in another. My only working idea is that I need
to make these interop dlls out of compatible versions of original
exchange dlls.

I imagine there may be a work around I can use here to tell it to use
the code as is even though it comes from a different assembly or to
force it to just use the integer counterparts for the enum values.
  Reply With Quote


  sponsored links


2 5th August 23:54
jeff garman msft
External User
 
Posts: 1
Default compilation error: The type is defined in an assembly that is not referenced



My guess here is that you do not have the references properly added to the
project. The following article explains the exact steps that are required
to get all of this to work in C# VS2005. But I imagine that the problem
that you are seeing is due to the fac that the references are not added to
the project. IN this case you should only need to add a reference to the
"Microsoft CDO for Windows 2000 Library" and that's it. You shouldn't
specifically add the ADO reference, it will be properly added when you add
the reference to CDOSYS to your project. Everything else should be taken
care of for you.

Here's the article:

310225 How to use the Cdosys.dll library to save a message to a file by
using Visual C#
http://support.microsoft.com/default.aspx?scid=kb;EN-US;310225

- Jeff
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666