Class Library

S

shapper

Hello,

I have been working on a project which has the following namespaces:

bNET
bNET.Blogger
bNET.FAQ
....

bNET will have a Configuration Class for Web.Config and other common
classes
bNET.Blogger will have classes to communicate with a database and a
few web controls, all related to my Blogger projects
....

I will always need to deliver bNET to my clients.
Sometimes I will deliver one or more than one of the other class
libraries.

My question is:
Should I create a project for each namespace and then compile them
individually?
In this case I would deliver, for example, bNET.dll, bNETBlogger.dll,
etc.

Or should I do everything on the same project?
And there maybe the is an option to only compile a part of it ...

Anyway, could someone advice me on this?

I really have no idea of how should organize this.

Thanks,
Miguel
 
L

Laurent Bugnion, MVP

Hi,
Hello,

I have been working on a project which has the following namespaces:

bNET
bNET.Blogger
bNET.FAQ
...

bNET will have a Configuration Class for Web.Config and other common
classes
bNET.Blogger will have classes to communicate with a database and a
few web controls, all related to my Blogger projects
...

I will always need to deliver bNET to my clients.
Sometimes I will deliver one or more than one of the other class
libraries.

My question is:
Should I create a project for each namespace and then compile them
individually?
In this case I would deliver, for example, bNET.dll, bNETBlogger.dll,
etc.

If you want to avoid giving unneeded code to your clients, then you'll
need to have multiple libraries, yes. If the code is in the DLL, then
the client can use it. The only way to prohibit this would be to
implement a complicated license checking mechanism, definitely not the
most interesting part of deploying a project.
Or should I do everything on the same project?
And there maybe the is an option to only compile a part of it ...

Using the configuration manager in Visual Studio, you can define
multiple configurations and then define conditional compilation symbols.
Then, in your code, you can use

#if USEBLOGGER

public void DoSomething()
{
// ...
}

#endif

The method DoSomething will only be included if the symbol USEBLOGGER is
set in the current configuration.

This way, you can include or exclude whole chunks of code, including
whole namespaces if you want. That avoids having multiple projects
(easier to manage), however if you use this approach, you need to
compile the same project multiple times with various configurations,
which can give serious headaches when you want to check which version of
the DLL has been deployed.

HTH,
Laurent
 

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

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top