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

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.
Nov 18 '08 #1
6 1186


"Curious" wrote:
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.
Nov 18 '08 #2
On Nov 18, 12:01*pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
"Curious" wrote:
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.
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
Nov 19 '08 #3


"Curious" wrote:
>
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
No, your solution should only need one project. This is why you had
multiple dlls created. To create a single dll, just have one project. In
the solution explorer, right click the project, and one of the options is
"Add" -"New Folder".

Now when you right click on the folder you just created, you can create a
class in that folder defaulting to the folder name as part of the namespace.
In your case, it appears your solution/project will be named "Utilities", and
you will have two folders called "lib1" and "lib2".

Mike

Nov 19 '08 #4

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
Nov 19 '08 #5
Thanks Mike for the advice! Now I've got it.

If I encounter any problems, I'll post in this thread again.
Nov 19 '08 #6
Thanks Mike for the advice! It works.
Nov 21 '08 #7

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

Similar topics

5
by: John Dewbert | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** Hello, I have trouble passing a folder object (from a FileSystemObject) to a sub procedure. Consider the following code: ...
2
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
5
by: Colleyville Alan | last post by:
I have a sub that can do two different tasks based on the value of one variable. So I'd like to have two different buttons on the same form run this, but each one setting a flag so that the...
7
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
12
by: Ron | last post by:
Greetings, I am trying to understand the rational for Raising Events instead of just calling a sub. Could someone explain the difference between the following 2 scenarios? Why would I want to...
4
by: dbuchanan | last post by:
Is the following behavior normal? Both the 'Protected sub' in the inherited form and the 'Private Shadows sub' in the derived form fires. My interpretation of MSDN help on the topic "Shadows"...
5
by: Sharon | last post by:
Hi all. To prevent access to a sub system internal types, is it necessary to create the sub system in a different project, and use the internal access level? Or is there another way that will...
6
by: Bob | last post by:
Hi, I found this code here below (about cartitems and shoppingcart) and I have two questions about sub New(). In the first class CartItem, there is two times sub New(): Public Sub New() End...
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
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...

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.