Source Code Management Methods

In recent years, I have written a lot of software, most of which tend to share one or more common libraries. (The most common library that is used to call SQL stored procedures and returned arrays of objects)

I am not happy with the way I manage libraries, and I am looking for suggestions to improve the way I work.

The first time I created what is now a shared library, I added the library as a separate class library project as part of the solution.

Now that I am launching a new solution, and I know that I will need the library that I already have, I will go and find the library project and copy the files to the new solution.

This leaves me with several copies of the same library project placed around my file system (and SVN server), and it just isn't.

Is there a better way to work, so I only have one main copy of this library that all solutions share, and not every solution that has its own copy of the library project?

+5
c # visual-studio-2008 projects-and-solutions shared-libraries
source share
4 answers

Just create the library once and refer to the compiled binary file from your project, which should use it.

In the visual studio, right-click on the project and click "add link", then select the "view" tab and find the binary libraries.

(Obviously, you will need to distribute the library assembly along with your application)

+5
source share

Your feeling is absolutely true. There should be only one master source library.

In our store, we have several common library projects used by several products. We view these libraries as the products themselves and view them accordingly. In particular, when a project needs one of these libraries, we put the compiled version of the library in the lib folder in the project. We remove the need to copy the source, and our project refers only to a stable copy of the dll.

Here is a sample structure in the repository

/LibraryX <- product root ../branches ../tags ../trunk <- solution folder ../LibraryX <- project folder ../lib <- thirdparty libraries used by LibraryX /ProductY <- product root ../branches ../tags ../trunk <- solution folder ../ProductY <- project folder ../lib <- thirdparty libraries used by ProductY, eg a copy of LibraryX.dll 

So, in the ProductY project, instead of including a copy of the LibraryY project, you add a link to the LibraryX.dll located in the lib folder.

+2
source share

I would suggest building your library in dll, which can be added as a link to any other project you are working on. Then you do not need to copy the source files everywhere.

+1
source share

You just have to build the DLL with your library and then just reference it.

Links> Add Link to VS.

+1
source share

All Articles