PC Review


Reply
Thread Tools Rate Thread

compilation error: The type is defined in an assembly that is not referenced

 
 
Omatase@gmail.com
Guest
Posts: n/a
 
      21st Jul 2006
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:\Documents and
Settings\davidbr\My
Documents\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
 
 
 
 
Dave Sexton
Guest
Posts: n/a
 
      21st Jul 2006
Hi Omatase,

See if there are any PIA (Primary Interop Assemblies) available for the
application before importing your own.

If you must import your own assemblies you might want to try the tlbimp
utility with the /reference switch so that the generated assemblies
reference each other. You must generate the assemblies in the correct
order. If you generated the assemblies with the appropriate references and
still get the error you are probably still missing type libraries that need
to be imported.

The last option would be to ditch CDO and ADO as they are legacy components
in the context of .NET. The .NET Framework provide intrinsic classes to
handle mail and data access.

- Dave Sexton

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:\Documents and
> Settings\davidbr\My
> Documents\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
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The type 'frm_data.frm_data' is defined in an assembly that is not referenced. You must add a reference to assembly ma79ash@gmail.com Microsoft C# .NET 3 4th Oct 2007 12:40 PM
DLL compilation error - assembly strong name Alan T Microsoft C# .NET 1 9th Nov 2006 06:25 AM
Could not load type from assembly compilation error ChrisB Microsoft Dot NET 0 23rd Sep 2005 09:41 PM
[Assembly] gives "Type 'Assembly' not defined" error PKuhne Microsoft VB .NET 2 3rd Jul 2005 12:35 PM
Dynamic load of type in non-referenced assembly? John Smith Microsoft C# .NET 2 30th Sep 2003 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:07 PM.