Class Library

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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
 
Back
Top