The type 'frm_data.frm_data' is defined in an assembly that is not referenced. You must add a refere

M

ma79ash

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.

So now
Sample_bl is having reference of Sample_dl project
and in
Sample_dl project i added a reference for frm_data.dll and made a
function call to a method of frm_data.dll from inside a method of
sample_dl. It works.

But, as soon as i try to inherit from a class in frm_data.dll to
sample_bl projects class. it builds.
But, Sample_bl on build gives an error ::

Error 1 The type 'frm_data.frm_data' is defined in an assembly that
is not referenced. You must add a reference to assembly 'framework_dl,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=72fb7114fd4e6ef7'. C:
\Temp\Test_Project\Sample\Sample_bl\components\Samplecomponent_bl.cs
16 13 Sample_bl



Please help. Basically i want to create dll's for the layered
projects and want to use in another layered application.

thanks
 
C

Christof Nordiek

Hi ma79ash,

your text is a little bit confusing
I guess you have a class in sample_dl wich inherits from a class frm_data in
assembly frm_data.
This inheriting class is referenced in sample_bl. For this to work in C# the
sample_bl has also to reference frm_data. This is, because the public
members of the base class are also public members of the inheriting class.
So the compiler has to know the base-class when referencing the derived
class.

In your case I would recommend to redesign your layer-concept, so that the
public classes of the business layer do not derive from the classes of the
data layer but encapsulate them

Christof
 
M

ma79ash

Hi Chris ,
Let me rephrase my question one more time.

I have ParentBusiness.dll , BusinessData.dll contains class
BaseBusiness.cs and ParentData.dll. contains class BaseData.cs I
created new Solutions , And with ChildBusinss and ChildData Layer .
Child Business contains reference of ParentBusiness.dll, and Child
Data layer contains reference of ParentDataLayer .

ChildData contains a Class which is inhereted from BaseData.cs
(ParentData.dll) . In this case , data Layer is building
successfully , But when i try to call a Method of Child Data class
from ChildBusiness , it thorw compilcation error as

"The type ParentData.basedata' is defined in an assembly that is not
referenced. You must add a reference to assembly"


error CS0012: The type ParentData.BaseDatai s defined in an assembly
that is not referenced. You must add a reference to assembly
'ParentData.dll, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null'.

Hope so this will help to understand the problem

Thanks in Advance
 
C

Christof Nordiek

Hi ma,

Hi Chris ,
Let me rephrase my question one more time.

I have ParentBusiness.dll , BusinessData.dll contains class
BaseBusiness.cs and ParentData.dll. contains class BaseData.cs I
created new Solutions , And with ChildBusinss and ChildData Layer .
Child Business contains reference of ParentBusiness.dll, and Child
Data layer contains reference of ParentDataLayer .

So far so good.
ChildData contains a Class which is inhereted from BaseData.cs
(ParentData.dll) . In this case , data Layer is building
successfully , But when i try to call a Method of Child Data class
from ChildBusiness , it thorw compilcation error as

Let's call the deriving classes DerivedData and DerivedBusiness
respectively.

Since the project ChildBusiness references DerivedData wich derives from
BaseData the project has to refernce project ParentData also.
This is, because the compiler wants to inspect class BaseData for members
ChildData inherits from BaseData aswell as maybe other base classes of
BaseDate.
"The type ParentData.basedata' is defined in an assembly that is not
referenced. You must add a reference to assembly"


error CS0012: The type ParentData.BaseDatai s defined in an assembly
that is not referenced. You must add a reference to assembly
'ParentData.dll, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null'.

As it says, you must add a reference to ParentData.dll. Any problem doing
so? The BusinessLayer of the second solution would reference both DataLayer
assemblies. I'd say, that is a reasonable design.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top