Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Sub-libraryies in a main library

Reply
 
Old 11-18-2008   #1 (permalink)
Curious


 
 

Sub-libraryies in a main library

I was asked to create a C#.NET Console Library project that contains
two sub-libraries. And each sub-library contains multiple utilties.

As an experiment, I've created a Console Library project (solution).
Then I've added two projects (they're supposed to be sub-libraries).
However, each project has its own indepent assembly in the form of
a .dll file.

It seems that there is no way I can create a unified assembly (a
single .dll file) containing both projects (or libraries). Any input
on how to solve this problem? I work with business people who don't
know .NET and they request me to do it this way.

My System SpecsSystem Spec
Old 11-18-2008   #2 (permalink)
Family Tree Mike


 
 

RE: Sub-libraryies in a main library



"Curious" wrote:
Quote:

> I was asked to create a C#.NET Console Library project that contains
> two sub-libraries. And each sub-library contains multiple utilties.
>
> As an experiment, I've created a Console Library project (solution).
> Then I've added two projects (they're supposed to be sub-libraries).
> However, each project has its own indepent assembly in the form of
> a .dll file.
>
> It seems that there is no way I can create a unified assembly (a
> single .dll file) containing both projects (or libraries). Any input
> on how to solve this problem? I work with business people who don't
> know .NET and they request me to do it this way.
>
You could ask them what they mean...

My first impression though would be to create two folders such as SubLib1
and SubLib2 in your single library project. This gives the classes created
in each folder different namespaces such as Project.SubLib1.Class1,
Project.SubLib2.Class2. It still compiles to a single dll. You don't need
to put the classes in separate folders as you could simply change the
namespaces in the class files, but I find it easier to manage them this way.


My System SpecsSystem Spec
Old 11-19-2008   #3 (permalink)
Curious


 
 

Re: Sub-libraryies in a main library

On Nov 18, 12:01*pm, Family Tree Mike
<FamilyTreeM...@xxxxxx> wrote:
Quote:

> "Curious" wrote:
Quote:

> > I was asked to create a C#.NET Console Library project that contains
> > two sub-libraries. And each sub-library contains multiple utilties.
>
Quote:

> > As an experiment, I've created a Console Library project (solution).
> > Then I've added two projects (they're supposed to be sub-libraries).
> > However, each project has its own indepent assembly in the form of
> > a .dll file.
>
Quote:

> > It seems that there is no way I can create a unified assembly (a
> > single .dll file) containing both projects (or libraries). Any input
> > on how to solve this problem? I work with business people who don't
> > know .NET and they request me to do it this way.
>
> You could ask them what they mean...
>
> My first impression though would be to create two folders such as SubLib1
> and SubLib2 in your single library project. *This gives the classes created
> in each folder different namespaces such as Project.SubLib1.Class1,
> Project.SubLib2.Class2. *It still compiles to a single dll. *You don't need
> to put the classes in separate folders as you could simply change the
> namespaces in the class files, but I find it easier to manage them this way.
They want a single assembly that contains a hierarchy of namespaces.
For instance, the assembly is "Utilities". There are two sub-libraries
(sub-namespaces) under "Utilities" called "Lib1" and "Lib2".

When I use each library, I use either namespace "Utilities.Lib1" or
namespace "Utilities.Lib2".

Question regarding your suggestion: I believe by project, you mean
"solution". Is that the case? Do I need to create multiple projects
under the solution for multiple sub-libraries? I guess not, because
that would result in multiple assemblies.

Shall I manually add the folders on the hard drive when I create the
project? How will the solution/pro
My System SpecsSystem Spec
Old 11-19-2008   #4 (permalink)
Family Tree Mike


 
 

Re: Sub-libraryies in a main library


Further info that I just realized I left off my most recent post.

Simply dragging class files that previously existed into the folder will not
change their namespace. The approach I am describing is how I start out a
project. Should you choose to go this way with previously existing class
files, you would need to manually change their namespaces.

Mike
My System SpecsSystem Spec
Old 11-21-2008   #5 (permalink)
Curious


 
 

Re: Sub-libraryies in a main library

Thanks Mike for the advice! It works.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Solved Officer Needs Help! 3rd and Main! General Discussion
Using Windows 7 as main OS Software
Outgoing main name Vista mail
WMP11 - can no longer find library or add to library Vista music pictures video
Vista as Main OS ?? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46