473,786 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Here is my code:

CDO.Message iMessage = new CDO.MessageClas s();

string sFrom; string sDate;

iMessage.DataSo urce.Open(bstrU RLItem,null,
ADODB.ConnectMo deEnum.adModeRe ad,
ADODB.RecordCre ateOptionsEnum. adFailIfNotExis ts,
ADODB.RecordOpe nOptionsEnum.ad OpenSource,""," ");

Here is the compilation error:

The type 'ADODB.ConnectM odeEnum' is defined in an assembly that is not
referenced. You must add a reference to assembly 'ADODB,
Version=7.0.330 0.0, Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a'. C:\Documents and
Settings\davidb r\My
Documents\Visua l Studio
2005\Projects\I nformXY\InformX Y\ExchangeEvent Sink.cs 45 25
InformXY

the error comes from argument number 3 on line:

iMessage.DataSo urce.Open(bstrU RLItem,null,
ADODB.ConnectMo deEnum.adModeRe ad,
ADODB.RecordCre ateOptionsEnum. adFailIfNotExis ts,
ADODB.RecordOpe nOptionsEnum.ad OpenSource,""," ");

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.ConnectMo deEnum
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.

Jul 21 '06 #1
1 10411
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

<Om*****@gmail. comwrote in message
news:11******** **************@ 75g2000cwc.goog legroups.com...
Here is my code:

CDO.Message iMessage = new CDO.MessageClas s();

string sFrom; string sDate;

iMessage.DataSo urce.Open(bstrU RLItem,null,
ADODB.ConnectMo deEnum.adModeRe ad,
ADODB.RecordCre ateOptionsEnum. adFailIfNotExis ts,
ADODB.RecordOpe nOptionsEnum.ad OpenSource,""," ");

Here is the compilation error:

The type 'ADODB.ConnectM odeEnum' is defined in an assembly that is not
referenced. You must add a reference to assembly 'ADODB,
Version=7.0.330 0.0, Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a'. C:\Documents and
Settings\davidb r\My
Documents\Visua l Studio
2005\Projects\I nformXY\InformX Y\ExchangeEvent Sink.cs 45 25
InformXY

the error comes from argument number 3 on line:

iMessage.DataSo urce.Open(bstrU RLItem,null,
ADODB.ConnectMo deEnum.adModeRe ad,
ADODB.RecordCre ateOptionsEnum. adFailIfNotExis ts,
ADODB.RecordOpe nOptionsEnum.ad OpenSource,""," ");

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.ConnectMo deEnum
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.

Jul 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4009
by: Jean Stax | last post by:
Hi ! I created a sample library project. In my second project I reference this library and make the following call, which returns "undefined value": Type myType = Type.GetType("SampleLib.MyClass"); My guess was that the function fails because my library isn't loaded yet.
6
2226
by: Joachim | last post by:
I made some project changes (which seems it doesn't help if I undo) which have created compilation error: " Server Error in '/PCSWebApp1' Application. -------------------------------------------------------------------------------- Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details
0
1378
by: Mythran | last post by:
I'm getting this error and Microsoft's site states that the way we are using our libraries is unsupported and the error is by design (go figure). My setup is simple and why it isn't supported is completely unclear to me. 1.) 2 Web Sites in solution, 1 DAL library, 1 BLL library, 1 Schema library (all in same solution). 2.) DAL and BLL libraries are inheriting ServicedComponent, referencing and importing System.EnterpriseServices,...
5
2951
by: Raterus | last post by:
I'm just throwing this error out for my sanity, I've seen posts about this, but never solutions. I'm using VS.NET 2003, Framework 1.1, and I'm getting a random error about every 1 out of 10 times I try to start to run/debug a project (through Visual Studio) Server Error in '/Intranet' Application. -------------------------------------------------------------------------------- Compilation Error Description: An error occurred during...
3
3352
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\1f575646\ad3a161b\assembly\dl2\57ca505e\044565c0_f84fc401\Test1.DLL' The problem is that the control is defined in two different assemblies
0
1271
by: Paul van Brenk | last post by:
Hi, after installing sp1 on windows 2003 I get the following error when accessing an aspx page in an otherwise asp application: error: Unable to generate a temporary class (result=1). error CS0011: Referenced class 'ASP.InvoiceExport_aspx' has base class or interface 'System.Web.UI.Page' defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web'. error CS0011: Referenced class...
4
1839
by: Vish | last post by:
Hi all, I am having a build error in one of the overloaded functions in my class. The function takes either a string as a parameter or a type referenced in another dll as a parameter. My class references the dll where the type of the parameter is defined. I am able to create to create my class in a form without any build errors and without any references to the DLL where the other parameter type is defined. The form only uses the...
2
4247
by: curious2007 | last post by:
During the linking I get the following: 1>Linking... 1>main.obj : error LNK2005: "double __cdecl sigma(class curious2007::pair<double,double> const &)" (?sigma@@YANABV?$pair@NN@curious2007@@@Z) already defined in Characteristics.obj 1>main.obj : error LNK2005: "double __cdecl sigma_linear(struct std::pair<double,double> const &)" (?sigma_linear@@YANABU?$pair@NN@std@@@Z) already defined in Characteristics.obj 1>main.obj : error LNK2005:...
0
1240
by: ardas111 | last post by:
Language :: VS.NET/ C# The type 'frm_data.frm_data' is defined in an assembly that is not referenced. You must add a reference to assembly I have a Frm_sol solution, which consists on 2 projects FRM_Business and frm_Data. I build the 2 projects and copied the dlls created from them, to another Solution having a Sample_website, sample_business and Sample_Data.
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.