Link to home
Start Free TrialLog in
Avatar of bjqrn
bjqrn

asked on

Sharing code between projects

What would be the best way of sharing code between two projects in vc.net 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!
Avatar of AlexFM
AlexFM

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.
Avatar of bjqrn

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bjqrn

ASKER

thanks alot!