Which is the preferred, to keep your library in the folder your executable, or to register it with GAC?
4 Answers
If your assembly (dll) is just for use by your application, install it in the same folder as the executable. This is usually the preferred method (and the majority use case).
If it will be used by many applications, possibly install it in the GAC. The GAC is really just for Microsoft assemblies.
I've recently written an application where I went one step further and merged the dll's into a single executable.
- 1
- 1
- 295,962
- 43
- 465
- 541
See the discussion here: Why should I NOT use the GAC?
TL;DR - it depends on your needs and preference. For most uses, I personally avoid the GAC.
- 1
- 1
- 885
- 7
- 11
You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
Refer: Global Assembly Cache
Also, Refer GAC vs BIN
- 15,958
- 2
- 45
- 52
I'd register with GAC to avoid confusion and respective your binaries clean. You can technically do it either way, but the best thing to do is keep it in their respective paths. You should use all of windows environment paths for respective file types such as user data and DLL's, etc.
Also see if you want to reuse this library. For global use by other apps and libraries, etc put in GAC. For local use just for the exe put it in the same path.
- 12,161
- 4
- 48
- 69