Sharing code between projects

What would be the best way of sharing code between two projects in 2003/2005. Would it be by adding the same files containing the code to both projects, making a DLL or some other way?

Im creating a TcpIP implementation and since both the server and the client must have a client I thaught it was a good idea.

It's for a course in programming and therefore I would like to implement it using interfaces and polymorphism, so the solution must be capable of that.

Any help appreciated!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The best way is writing Dll.
One exception of this rule is code which can be placed in h-files: constants, templates, inline functions. Such files can be placed to some common directory and included to both projects.

Source file which belongs to two projects is not a good idea because of two reasons:
1) Synchronization problems between two projects.
2) Visual Studio doesn't source files in other directories and you can loose some of IDE support like Intellicense, Class View etc.
bjqrnAuthor Commented:
Is there a good tuorial on writing .NET dlls then? I need to be able to use classes as I would when writing .cpp and .h files.

I would want it to work as System.dll, System.XML.dll and such.
Make the following steps:
1) Create C++/CLI Class Library project. Add required classes to it. Every managed public class from class library is available for .NET clients.
2) Client project can be written in any .NET language. Add reference to class library to client project and use classes from library in the code.
If library and client are in different solutions, you need to browse and add library Dll in Add References dialog. If they belong to the same solution, you can select library project in the Projects tab.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bjqrnAuthor Commented:
thanks alot!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.