Building a C# library

  • Thread starter Thread starter Player
  • Start date Start date
P

Player

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all

I am using VS.NET 2003.

What I am doing apart from teaching myself C# is learning my way round
V.NET2003 also.

OK so I have a project, it's built and saved.
I also want to start my own collection of Classes that I will save up and
store for future use.

My questions are thus..

In making my new class library, do I just create a new Solution directory,
probably called something like,
MyName.ClassLibrary, then every time I create a class that I like, I just
put it in a class file, build it, add that file, built as it's own .dll now,
to that solution directory??

Also after there a few classes built as .dll's in that solution directory,
how do I then add a class .dll file to any new projects I am working on that
I might need to use it within?

Is it just a case of going to Solution Explorer, right clicking on
References/Add Reference, then going to Projects, and Browsing to the
Solution directory were my class built .dll files are, and adding it to the
References?

Then in my current project I can just use the key word, "using" in a way
similar to,

using blah = MyName.ClassLibrary.MyClass; // <-------is it best to put the
actual class .dll file also?

and then I can create objects of that class ??

If I am missing any steps out, or have got any steps wrong, any help with it
would be greatly appreciated thanks.

I think I have it down right, I am just not 100% sure about it.


Thanks in advance again :)

Player

- --
***********
I hear, and I forget.
I see, and I remember.
I do, and I understand.
- -- Confucius
************
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBQYexUy/z2sM4qf2WEQIW/wCg0RRqdee+732UQAKA1dAKubUjvlkAniGI
tKnQRZrtVCRkQ63SkyXB+H5i
=T/R4
-----END PGP SIGNATURE-----
 
if you're building up a list of DLL's as part of one solution, then they are
separate "projects" in one "solution".

In your solution, right clikc in the Solution Explorer on the solution and
say add -> new project. Select the dll from there...

To refence this from your other projects, simply right click on the
"References" tag (again in the Solution Explorer) for that project and say
add reference. Then in the tabs select "Projects" in which you'll see your
class library, from which you'll able to reference your DLL project.

Don't reference the DLL file directly... This way you'll able to change
builds (debug/release) and have that build of the project correlate to the
class library of the same build. I.E Debug built app would point to a debug
build of a DLL, and clicking Release would build release app to release DLL.

good luck!

Dan.
 
Back
Top