Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inheriting from another assembly

Status
Not open for further replies.

Affleck

Technical User
Jun 19, 2001
26
0
0
GB
Hi all,

I am developing a 3 tier .net application using vs.net.
On complitation the app will have 4 assemblies:

Ntpct.LoanEquipment.BusinessTier.dll
Ntpct.LoanEquipment.DataAccessTier.dll
Ntpct.LoanEquipment.PresentationTier.dll (web app)
Ntpct.Utility.dll

the Utility assembly in the Ntpct namespace has some utility classes that I want to inherit from in the business tier of the Ntpct.LoanEquipment Namespace.

I am using the following code to inherit:
public class User : Ntpct.Utility.BaseUser

I have added a reference to the Ntpct.Utility assembly in the businessTier project however when I compile i get the follwoing error:

c:\ Referenced class 'Ntpct.LoanEquipment.BusinessTier.User' has base class or interface 'Ntpct.Utility.BaseUser' defined in an assembly that is not referenced. You must add a reference to assembly 'Ntpct.Utility'.

please help as I feel i will be losing hair and sleep over this.

p.s I have tried adding the assembly to the GAC but I still get the same compilation error.

TIA

Affleck




there are 10 types of people in this world those who understand binary, and those who don't.
 
Have you referenced it in your "using" clauses at the top of the code file?

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Yes I have referenced the utility namespace as so:

using Ntpct.Utility;





there are 10 types of people in this world those who understand binary, and those who don't.
 
So all four are in the same solution?

And how did you reference them. Via the projects tab or via the .net tab?

Christiaan Baes
Belgium

"My new site" - Me
 
Yeah, all four are in the same solution. When you say using the .net tab do you mean selecting the assembly from the list, or using the browse to point to the dll? - The assembly is not in the list despite it being added to the GAC.

cheers

Affleck

there are 10 types of people in this world those who understand binary, and those who don't.
 
To get it to appear in the list of references in VS you need to add the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyFramework
(Default) = "C:\Source\MyFramework\Assemblies"

That will get them to show up. Once you've done that, just right click the references tab, and click add reference. You should be able to browse to it.

Also, right click the new reference and click properties. Make sure the "Specific Version" option is set to false. Else it will only ever build with 1 version of your framework.

HTH.

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
if they are in the same solution you should reference them via the projects tab not the .net tab and no need to use the gac either. Since the projects are going to change while you develop that wouldn't be a good idea. If you reference them via projects then VS will take care of it for you and rebuild them when needed.

Christiaan Baes
Belgium

"My new site" - Me
 
Thanks Chrissie, but this is how I originally referenced the assembly and it didn't work. Perhaps I am been ignorant here and you simply can not inherit from a baseClass in a different assembly...

I'm sure I have done this before in Java though.

I will try the GAC again i think.

:)

Thanks

there are 10 types of people in this world those who understand binary, and those who don't.
 
It is perfectly possible to do it since I do it all the time. And just the way I told you before.

Christiaan Baes
Belgium

"My new site" - Me
 
Doh!!

I only needed to add a reference to the Utility namespace in the presentationTier also since the User object inherits from this.

Thanks for your help guys!

Affleck

there are 10 types of people in this world those who understand binary, and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top