473,395 Members | 1,815 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,395 software developers and data experts.

Assembly reference once removed.

Hello,

I have a control derived from a 3rd party control. My control sits in a
class library. I have an app referencing my class library. When I
compile the app, I'm told:

c:\pd\NET\Examples\AssRef\AssRef\bin\Debug\Mine.dl l Referenced class
'Mine.Fred' has base class or interface 'Theirs.Flintstone' defined in an
assembly that is not referenced. You must add a reference to assembly
'Theirs'.

Here's some code to reproduce the behaviour:

// main app
using System;
using Mine;

namespace AssRef
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Mine.Fred fred = new Fred();
}
}
}

// my class library
using System;
using Theirs;

namespace Mine
{
public class Fred : Theirs.Flintstone
{
public Fred()
{
}
}
}

// 3rd party control

using System;

namespace Theirs
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Flintstone
{
public Flintstone()
{
}
}
}

In VS.NET create 2 class libraries and a console app, when you build the
solution, you'll get this:

c:\pd\NET\Examples\AssRef\AssRef\bin\Debug\Mine.dl l Referenced class
'Mine.Fred' has base class or interface 'Theirs.Flintstone' defined in an
assembly that is not referenced. You must add a reference to assembly
'Theirs'.

Why? "Mine" already has an explicit reference to the "Theirs" DLL.

Thanks for any help,

..pd.
Nov 15 '05 #1
4 4473
Hello

Your app should also reference the 3rd party control's assembly.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

".pd." <sp*****@your.peril> wrote in message
news:Xn*****************************@194.83.179.10 2...
Hello,

I have a control derived from a 3rd party control. My control sits in a
class library. I have an app referencing my class library. When I
compile the app, I'm told:

c:\pd\NET\Examples\AssRef\AssRef\bin\Debug\Mine.dl l Referenced class
'Mine.Fred' has base class or interface 'Theirs.Flintstone' defined in an
assembly that is not referenced. You must add a reference to assembly
'Theirs'.

Here's some code to reproduce the behaviour:

// main app
using System;
using Mine;

namespace AssRef
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Mine.Fred fred = new Fred();
}
}
}

// my class library
using System;
using Theirs;

namespace Mine
{
public class Fred : Theirs.Flintstone
{
public Fred()
{
}
}
}

// 3rd party control

using System;

namespace Theirs
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Flintstone
{
public Flintstone()
{
}
}
}

In VS.NET create 2 class libraries and a console app, when you build the
solution, you'll get this:

c:\pd\NET\Examples\AssRef\AssRef\bin\Debug\Mine.dl l Referenced class
'Mine.Fred' has base class or interface 'Theirs.Flintstone' defined in an
assembly that is not referenced. You must add a reference to assembly
'Theirs'.

Why? "Mine" already has an explicit reference to the "Theirs" DLL.

Thanks for any help,

.pd.


Nov 15 '05 #2
Dmitriy Lapshin [C# / .NET MVP] wrote on Fri 19 Dec 2003 02:28:56p:
Your app should also reference the 3rd party control's assembly.


That's what the error message says and is indeed how to fix the problem.
But I don't understand why it *should* be a problem.

What I wanna know is why, when Theirs is not (directly) used by Main,
should Main require a reference to Theirs?

Mine has a reference to Theirs and therefore when control is passed to
Mine, the reference required to reach the referenced code in Theirs is
present.

Why does this stipulation exist? What justification is there for it? If
Mine.DLL was created to use Theirs.DLL, the developer of Mine made the
decision to use version n.n.n of Theirs. Users of Mine shouldn't need to
know that Mine makes calls to other assemblies - but if it should, then
why?

If a developer of Main now has to add a reference to Theirs to get Mine to
work, doesn't that then create a risk that s/he will reference the wrong
version of Theirs? What about transparency?

..pd.
Nov 15 '05 #3
Just because Mine has a reference to Theirs doesn't mean Mine contains
all the implementation and type declarations of Theirs. What if your app
needs to access base members in Flinstone? The app needs a reference to
Theirs so it can cast your Fred class as Flinstone, and execute the get/set
accessors (or whatever else) found in the Theirs assembly.

Erik
"Da5id" <sp*****@your.peril> wrote in message
news:Xn*****************************@194.83.179.10 2...
Dmitriy Lapshin [C# / .NET MVP] wrote on Fri 19 Dec 2003 02:28:56p:
Your app should also reference the 3rd party control's assembly.


That's what the error message says and is indeed how to fix the problem.
But I don't understand why it *should* be a problem.

What I wanna know is why, when Theirs is not (directly) used by Main,
should Main require a reference to Theirs?

Mine has a reference to Theirs and therefore when control is passed to
Mine, the reference required to reach the referenced code in Theirs is
present.

Why does this stipulation exist? What justification is there for it? If
Mine.DLL was created to use Theirs.DLL, the developer of Mine made the
decision to use version n.n.n of Theirs. Users of Mine shouldn't need to
know that Mine makes calls to other assemblies - but if it should, then
why?

If a developer of Main now has to add a reference to Theirs to get Mine to
work, doesn't that then create a risk that s/he will reference the wrong
version of Theirs? What about transparency?

.pd.

Nov 15 '05 #4
Well, since C# has no notion of private inheritance like C++, all base
classes contribute methods, properties, etc. to your class. Thus the
compiler needs to see all metadata for the base types. Now if you used
containment rather than inheritance, that would be different. Then you
could successfully structure your assembly so that no clients would ever
need to directly reference your dependencies.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Da5id" <sp*****@your.peril> wrote in message
news:Xn*****************************@194.83.179.10 2...
Dmitriy Lapshin [C# / .NET MVP] wrote on Fri 19 Dec 2003 02:28:56p:
Your app should also reference the 3rd party control's assembly.


That's what the error message says and is indeed how to fix the problem.
But I don't understand why it *should* be a problem.

What I wanna know is why, when Theirs is not (directly) used by Main,
should Main require a reference to Theirs?

Mine has a reference to Theirs and therefore when control is passed to
Mine, the reference required to reach the referenced code in Theirs is
present.

Why does this stipulation exist? What justification is there for it? If
Mine.DLL was created to use Theirs.DLL, the developer of Mine made the
decision to use version n.n.n of Theirs. Users of Mine shouldn't need to
know that Mine makes calls to other assemblies - but if it should, then
why?

If a developer of Main now has to add a reference to Theirs to get Mine to
work, doesn't that then create a risk that s/he will reference the wrong
version of Theirs? What about transparency?

.pd.

Nov 15 '05 #5

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

Similar topics

2
by: Peter Gomis | last post by:
I have encountered a situation where I am unable to remove a .NET assembly from the GAC. The message I receive is "Assembly 'assemblyname' could not be uninstalled because it is required by other...
6
by: Matt Frame | last post by:
I wrote a small assembly to test the process of placing it into the Global Assembly Cache but now I cannot remove it. When I hi-light and click delete I get the following: Assembly 'Assembly...
26
by: nospam | last post by:
Just wondering, What do you think the difference in performance would be between (1.) Compiled C# (2.) Compiled C++ (3.) and Assembly Language And how would the mix be if some if any of...
3
by: Makarand Keer | last post by:
Hi All I have around 3 versions of same assembly installed in my GAC. Now I have to un-install all these assem from GAC, for this I removed all the references to these assem and called gacutil -...
1
by: Greg Patrick | last post by:
My problem: I load an some assemblies (strong named) from a byte array using Assembly.Load(byte). They load fine. But one one of them is actually accessed, it's referenced assemblies can't be...
0
by: Jim Bancroft | last post by:
I'm having trouble using my VB class library in ASP.Net-- the webserver gives following error when any component is created from my assembly. This just started today (was fine on Friday): ...
5
by: Diffident | last post by:
Hello All, I am trying to add an assembly to GAC but having difficult time figuring out the concept of GAC. This is what I am trying to do.... 1. Installed NUnit framework whose DLL...
1
by: Atmapuri | last post by:
Hi! I have a C# project which references assembly myassembly.dll. The project worked fine. Then I removed the reference from the Reference list and added the assembly with the same name, but an...
2
by: John Bailey | last post by:
I have checked around and could not find anything here that exactly matches my issue, which is odd since I have found numerous posts on this in other news groups. I have a ASP .Net 2.0 site that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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...
0
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...
0
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,...

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.