Re: Adding references: the details
- From: "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@xxxxxxxxx>
- Date: Thu, 19 Jan 2006 00:39:37 -0800
_DS wrote:
> On Tue, 17 Jan 2006 01:42:55 -0800, "Frans Bouma [C# MVP]"
> <perseus.usenetNOSPAM@xxxxxxxxx> wrote:
>
> > _DS wrote:
> >
> >> Add existing project to the solution, then add a ref to
> 'Project'. >>
> >> 1: I'd like to find out what the latter method is doing.
> >> I'm assuming that it makes sure that debug exe gets matched to
> >> debug DLL, etc. What else is going on? (I couldn't locate
> much >> info in MSDN)
>
> > the second option adds a reference to project\obj\assembly.dll for
> > compilation and in the csproj file it adds a reference to the
> > project instead of the dll, that's it.
>
> It could ref either the debug or the release version. Since the
> project was now being referenced as a whole, I assumed that the
> correct match for given compilation mode (debug vs release ) would be
> chosen. Sounds like the answer is No. So which DLL would be chosen?
the one belonging to the current action. So if you build a debug
build, the debug version is referenced. THough that doesn't matter. In
debug or release, the assembly names are the same, which is what
matters.
> >> I hope that was understandable. Any way to simplify that, or must
> >> the top solution go through the add-to-project and
> add-ref-to-project >> for every sub-sub-sub-assembly that's
> referenced?
> >
> > That shouldn't be necessary. My exe references assembly A, which
> > references assembly B and B is placed inside the bin folder of the
> > exe without a problem, automatically.
>
> Then something is not right. The Exe is never referring to B
> directly.
No of course it isn't doing that. but B is ending up in the bin\debug
or bin\release folders and when you try to run the exe it will run.
If the exe is referring in code to types in B, B has to be referenced
manually.
> The Exe refers only to A, which in turn refers to B.
> You'd think that compile references would handle this. But though A
> and B are compilable on their own, adding assembly A to the exe file
> will generate an error message about unresolved items in B.
>
> What could cause or fix that?
Please remember that 'an error message' is a statement which doesn't
help, please state the error message you get, I'll now assume what
happens and I think it's because you have a base type in B, you derive
a class from that in A and you use that type in the .exe, correct? The
..exe then needs a reference to B if you in your code use public
methods/properties from the type which are actually defined in the base
class in B. This is logical, as the methods/properties aren't known in
A, they're defined in B.
This indeed isn't done automatically, the error description suggests
what to do to fix it.
FB
--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
.
- References:
- Adding references: the details
- From: _DS
- Re: Adding references: the details
- From: Frans Bouma [C# MVP]
- Re: Adding references: the details
- From: _DS
- Adding references: the details
- Prev by Date: about locating assemblies
- Next by Date: How to create event templates using vs.net 2003
- Previous by thread: Re: Adding references: the details
- Next by thread: multiple language support in C#
- Index(es):
Relevant Pages
|