a solution and multiple projects

D

dominique

Hi,

In windows app, i have a solution with multiple projects.

If a project must "see" types (class, modules, structures, delegates,
enum) of an other project, we must add reference to this project (in
solution explorer, right clic on add reference, then third tab Add
project).

Now my question :
we can Add reference to the project or to the dll of the project (with
browse).

When do we choose "reference to a project" and when do we choose
"reference to the dll of the project" ?

What are the best practices ?

What are the impacts on debug mode and on executable file ?

If we choose "reference to the dll of the project" :
- what dll do we choose ? in the folder \bin or obj\debug ?
- how does VS work then in debug mode ? with the project.pdb ?

Thanks in advance.

Dominique Gratpain
 
C

CJ Taylor

Hey Dominque,

When you reference another project within a solution you reference a
complied dll. However, you don't reference the dll located in the bin/
directory of dll project, it is referenced in the debug/ directory instead.

As for a best practice, its negotiable. Some like to perfect their dll's
before they reference it in a project, but then again, sometimes your
developing the whole thing together. It's kinda preference, just as long as
in the end, it all works well together.

In VB6 this was more of a concern (because DLL's were all ActiveX Dll's, not
regular DLL's) therefore had to be registered within the registry. Because
DLL's are no longer registered (unless they expose a COM interface) this
isn't as big of a concern (no more binary/project compatibility!)

Instead, in .NET, it references the debug version, which dynamically updates
the version referenced when compiled. (This is where project build order is
important, but VS.NET takes care of that for you).

In the end your always referencing a compiled assembly. Just where the
location is, what version it is changes between testing/deployment. It
should have no affect on performance in the end.

HTH,
CJ
 
D

dominique

Thanks Herfried and CJ for yours answers.

It is true that, when we reference a project, it is
obj\debug\project.dll which is referenced (we can see it in solution
explorer, right click on the reference then Properties).

But many developpers in samples on the net say : add a reference with
the bin dll not the project. Why ?

Best regards

Dominique
 
C

CJ Taylor

Thanks Herfried and CJ for yours answers.
It is true that, when we reference a project, it is
obj\debug\project.dll which is referenced (we can see it in solution
explorer, right click on the reference then Properties).

But many developpers in samples on the net say : add a reference with
the bin dll not the project. Why ?

As I said in my first response, a lot of developers like to fully develop
there supporting classes first for version compatibility. This is important
in a lot of multi-developer environments. But .NET doesn't have as many
versioning issues as other languages such as VB Classic.

It's a matter of preference. if you are a single developer working on
multiple projects, it doesn't matter. Because only you are modifying that
code. The two assemblies are no different though whether you use the bin
dll or the debug dll.

The only major difference is the project reference gets updated each time at
complile with the new version. I suppose if you have something that is
version specific... sure.. but you can adjust that in your assembly.vb file.

-CJ
 

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