简体   繁体   中英

Share Common codes between multiple projects

I have a class library project contains common codes that used in my projects and i use subversion as source control.
i have some question about managing solution,projects and codes for usability.
I want share this class library between projects and when i update it , the update applying easily to all projects.Where can i locate this class library to share between projects and improve source controlling , usability and ...?

Any Idea?

You can use NuGet packages as a means of distributing the DLLs - build your common assemblies, pack build results into a specific directory and use that directory as a repository for NuGet Package Manager. One part of NuGet options is downloading the latest package version automatically, so whenever you open the solution, the package manager scans the repository for newer version and downloads it, if there is one.

Here's a very easy tutorial: http://juristr.com/blog/2012/04/using-nuget-to-distribute-our-company/

You can use several approaches:

  1. You can add this project as existing project to all solutions from one place. It is simplest method, but when it is changed in one solution, all other can become broken.

  2. You can branch your common library project to all solutions as different brunch. In this case, when you change it in one solution, all other solutions will not brake, but you should spend much time to merge changes from all brunches of your common library.

A solution can contain many projects, so you can effectively put the class library project anywhere and reference it from each new solution as required. This means you have only one copy of the source on your machine.

When you build each project it will compile the class library if necessary so all you need to do is have some process that keeps the source up to date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM