468,278 Members | 1,544 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,278 developers. It's quick & easy.

Building a C# library


-----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-----
Nov 16 '05 #1
1 1439
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.

"Player" <gu***@My.email.address.scum.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...

-----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-----

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Rob Dijkshoorn | last post: by
7 posts views Thread by Erik Johnson | last post: by
reply views Thread by Samuel M. Smith | last post: by
17 posts views Thread by Nick | last post: by
3 posts views Thread by Arjen | last post: by
12 posts views Thread by Ludwig | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.