How do you host external libraries in your .Net projects?

Many of my projects contain a Castle / NHibernate / Rhino-Tools stack. What is confusing about this is that the lock depends on some NHibernate libraries, NHibernate depends on some Castle libraries, and Rhino-Tools depends on both.

I built all three projects on my machine, but I feel that copying the NHibernate / Castle libraries is a bit redundant since I built Rhino-Tools using the libraries I got from my NHibernate and Castle builds.

Currently, I include all projects in separate folders in the / thirdparty / libs folder in my project tree. Should I just have / thirdparty / libs / rhino -tools in my project and use the Castle / NHibernate libraries? It would seem that the logical point is not to duplicate files, but I also like to have each project in its own separate folder.

What are your views on this?

+6
c # dependency-management
source share
4 answers

This is one of the problems we are trying to solve in the Refix open source project on CodePlex .

The idea is that Refix will analyze all the projects in your solution and before compiling your project, copy the necessary files from one local repository on your computer to a folder in the decision tree and point to the projects. Thus, there is no need to commit binary files. Your local Refix repository will pull binary files from the remote (we install it on repo.refixcentral.com), and you can set up an intermediate for your team / department / company, which can contain any additional software that does not have central access.

He will also try to resolve conflicting version numbers. Visual Studio can forgive too many invalid component version numbers, which leads to solutions that compile but fail at runtime when they do not load the dependency because two different versions are required.

So, to answer the question "how do you package external libraries in your .Net projects", our vision is that you do not do this - you just include the Refix step in your build script, and let this worry about it for you .

+3
source share

I use a folder for every one that seems to be a convention.

  • Does it really matter if you copy them?
  • What if you want to disable it? Let's say you go with the new O / R mapper. It's much easier to just delete the NHibernate folder than to selectively delete the DLLs in the Rhino-Tools folder.
  • Take this to logical conclusion, and you will not have any folder organization in your lib folder, since everything uses log4net :)
+1
source share

Add additional verification paths to the app.config files to find the dependency dlls. That way, you can only have one copy of everything you want. Although there are some quirks for using this feature (you have to create a folder structure in a certain way). Check here for more information on the tag.

+1
source share

I definitely recommend having a folder of third parties or suppliers in each of your project trees. If you are unpleasant to have 32 copies of the rhino-tools package, you can have one copy in your code repository and make external links to it in your project tree.

Suppose you are using SVN, you can create a repository called "thirdparty libs", in which case there are copies of the libs versions. Then you create an external property in your โ€œthird-partyโ€ stick in the tree of your project, which then automatically automatically checks your centralized third-party libraries. Thus, you, for example, should be updated only in one place if protection or correction appears, but each project can still choose which third-party libraries and which versions to use.

About depicts inside third-party libs, I would not mind them. The first time you compile your project, and some of the libs arent files are copied to the bin folder due to implicit dependencies, you can add an external attribute to your bin folder, which will then automatically check for the missing libraries. Thus, you just have to update your third-party libraries in one place.

+1
source share

All Articles