473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

again abstract class problems

Hi again,

in the past I have posted here a problem with static methods and
abstract classes, and Jon Skeet and Richard Lowe have helped me to
clarify the things.

But now I have found another problem (I have posted similar thing in
vs.ide newsgroup, but I do not know if this is and IDE or C# problem, so
I post it here also).

So, in my solution I have:
1. base project, where I have some base classes and interfaces. Actually
I use this project in most of my solutions. Some of the classes are
abstract (with some implemented and some abstract methods). Most of the
classes here are for logging purposes, and to clarify interfaces for
structuring all my apps. For the purpose of this post I'll put the
following class:
namespace Company.Base
{
public abstract class MyVeryBaseClass
{
public static void DoBaseWork()
{
Console.WriteLine("MyVeryBaseClass.DoBaseWork called");
}

public abstract void AbstractDoWork();
}
}

2. Another base project, which is solution oriented. Here are classes
which are base for the current solution, and some of them inherits from
the previous project, and implements the abstract methods, like:

using Company.Base
// the corresponding reference in the project is set to the above
//mentioned project (add reference.../projects)
namespace Company.Solution.Base
{
public class MySolutionBase : MyVeryBaseClass
{
public override void AbstractDoWork()
{
Console.WriteLine("MySolutionBase.AbstractDoWork called");
}

public static void NewBaseMethod()
{
Console.WriteLine("MySolutionBase.NewBaseMethod called");
}

public static void NewDependentMethod
{
MySolutionBase.DoBaseWork(); //inherited
}
}
}

3. Some other projects - midtier, server and client, which I reference
to 2nd project (MySolutionBase), like:

using Company.Solution.Base
//reference set to the project
namespace Company.Solution.Client
{
public class MyClient
{
public void DoSomething()
{
MySolutionBase obj = new MySolutionBase();
obj.AbstractDoWork(); //works as expected
MySolutionBase.NewBaseMethod(); //works as expected
MySolutionBase.NewDependentMethod();
//fails to load the assembly
}
}
}

So, in all the references I have CopyLocal property set to true, in
order to copy the dependent dll's in the project bin directory.

The last project (3) has reference only to project (2), and it copies
the dll from there, but does not copy the subdependent dll, so the
execution of the lass call fails.
Yes, I know the workaround - to add a reference to MyVeryBase project,
but this does not look right to me.

My question is more general - do I miss something in the settings, or
this behavior is by design, or ... what?

And also, is this a C#/CLR limitation, or is IDE stuff?

Thanks for reading this
Sunny
Nov 15 '05 #1
3 1510
Hello Sunny,

Thanks for your post. I reviewed your description carefully, and I believe
it's the same with the original issue you posted in the vsnet.ide. I
followed your steps to create a solution with the projects in VS .NET 2003,
however, I am not able to build the solution with the following error:

h:\Test\ConsoleApplication1\bin\Debug\ClassLibrary 2.dll Referenced class
'Company.Solution.Base.MySolutionBase' has base class or interface
'Company.Base.MyVeryBaseClass' defined in an assembly that is not
referenced. You must add a reference to assembly 'ClassLibrary1'.

Apparantly, it requires a reference to the MyVeryBase project in the client
project.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #2
Hi Tian,
I'm so ashamed :(
I haven't tested what I have posted. In my original solution it seems in
the past I have made the reference (maybe forced by such an error
message).
So sorry that I have lost your time with this.

It seems that happens only with interop assemblies in SDK, like mshtml.
While I work on the dev machine, everything is ok, without references,
because I guess it is in the GAC and server assembly does not look for
it in the bin directory, but if I move to another server, and I haven't
make a reference in the project, this dll is not there.

So, we are back to my orig. post in vs.ide group.

Sorry again
Sunny
In article <Iq**************@cpmsftngxa06.phx.gbl>,
ti******@online.microsoft.com says...
Hello Sunny,

Thanks for your post. I reviewed your description carefully, and I believe
it's the same with the original issue you posted in the vsnet.ide. I
followed your steps to create a solution with the projects in VS .NET 2003,
however, I am not able to build the solution with the following error:

h:\Test\ConsoleApplication1\bin\Debug\ClassLibrary 2.dll Referenced class
'Company.Solution.Base.MySolutionBase' has base class or interface
'Company.Base.MyVeryBaseClass' defined in an assembly that is not
referenced. You must add a reference to assembly 'ClassLibrary1'.

Apparantly, it requires a reference to the MyVeryBase project in the client
project.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3
Hi Sunny,

It is fine and you are always welcome! :-)

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #4

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

Similar topics

17
by: Medi Montaseri | last post by:
Hi, Given a collection of similar but not exact entities (or products) Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern to provide a common interface to these products....
9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
9
by: Christian Christmann | last post by:
Hi, I've a class Handler which contains a STL list std::list<Abstract*> mAbstract; which is storing elements of the abstract class Abstract. Further this class has a getElement function to...
3
by: Magne Ryholt | last post by:
I have a base class and a chain of derived classes. The base and its derived classes are all abstract except the last in chain (a concrete class). I want to provide some functionalities in the...
3
by: WithPit | last post by:
I am trying to create an managed wrapper but have some problems with it by using abstract classes. In my unmanaged library code i had the following three classes with the following hierarchy ...
9
by: silversurfer2025 | last post by:
Hello everyone, I am currently having problems with a C++ abstract class. I have a class FrameWork.h which defines some methods (of which some are abstract, i.e. virtual void method() = 0). In...
4
by: Eric | last post by:
I was wondering what people thought about the information found at: http://g.oswego.edu/dl/mood/C++AsIDL.html Specifically, I am interested in the following recommendation: ---- Since...
20
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.